Files
AnabasisChatRemove/.gitea/workflows/release.yml
benya c8da0f9191
Some checks failed
Desktop CI / tests (push) Successful in 13s
Desktop Release / release (push) Failing after 14s
ci(release): use preinstalled Python on self-hosted windows runner
2026-02-15 17:20:42 +03:00

110 lines
3.5 KiB
YAML

name: Desktop Release
on:
push:
branches:
- master
jobs:
release:
runs-on: windows
steps:
- name: Checkout
uses: https://git.daemonlord.ru/actions/checkout@v4
with:
fetch-depth: 0
tags: true
- name: Ensure Python 3.13
shell: powershell
run: |
if (Get-Command python -ErrorAction SilentlyContinue) {
python --version
} elseif (Get-Command py -ErrorAction SilentlyContinue) {
$pyExe = py -3.13 -c "import sys; print(sys.executable)"
if (-not $pyExe) {
throw "Python 3.13 launcher is available, but interpreter was not found."
}
Split-Path $pyExe | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
python --version
} else {
throw "Python is not installed on runner. Install Python 3.13 and restart runner service."
}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt pyinstaller
- name: Extract app version
id: extract_version
shell: bash
run: |
VERSION=$(python -c "from app_version import APP_VERSION; print(APP_VERSION)")
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
echo "Detected version: $VERSION"
- name: Stop if version already released
id: stop
shell: bash
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
if git show-ref --tags --quiet --verify "refs/tags/$VERSION"; then
echo "Version $VERSION already released, stopping job."
echo "CONTINUE=false" >> "$GITHUB_ENV"
else
echo "Version $VERSION not released yet, continuing workflow..."
echo "CONTINUE=true" >> "$GITHUB_ENV"
fi
- name: Run tests
if: env.CONTINUE == 'true'
shell: bash
run: |
python -m py_compile app_version.py main.py build.py tests/test_auth_relogin_smoke.py
python -m unittest tests/test_auth_relogin_smoke.py
- name: Build release zip
if: env.CONTINUE == 'true'
shell: bash
run: |
python build.py
- name: Ensure archive exists
if: env.CONTINUE == 'true'
shell: bash
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
test -f "dist/AnabasisManager-$VERSION.zip"
- name: Configure git identity
if: env.CONTINUE == 'true'
shell: bash
run: |
git config user.name "gitea-actions"
git config user.email "gitea-actions@daemonlord.ru"
- name: Create git tag
if: env.CONTINUE == 'true'
shell: bash
run: |
VERSION="${{ steps.extract_version.outputs.version }}"
git tag "$VERSION"
git push origin "$VERSION"
- name: Create Gitea Release
if: env.CONTINUE == 'true'
uses: https://git.daemonlord.ru/actions/gitea-release-action@v1
with:
server_url: https://git.daemonlord.ru
repository: ${{ gitea.repository }}
token: ${{ secrets.API_TOKEN }}
tag_name: ${{ steps.extract_version.outputs.version }}
name: Release ${{ steps.extract_version.outputs.version }}
body: |
Desktop release ${{ steps.extract_version.outputs.version }}
files: |
dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip