Files
AnabasisChatRemove/.gitea/workflows/release.yml
benya 098a84e5bd
Some checks failed
Desktop CI / tests (push) Successful in 12s
Desktop Release / release (push) Failing after 2m42s
ci(release): restore powershell node bootstrap
2026-02-15 16:42:08 +03:00

120 lines
3.9 KiB
YAML

name: Desktop Release
on:
push:
branches:
- master
jobs:
release:
runs-on: windows
steps:
- name: Ensure Node.js for Gitea actions
shell: powershell
run: |
if (Get-Command node -ErrorAction SilentlyContinue) {
node --version
exit 0
}
$nodeVersion = "v20.19.0"
$zipUrl = "https://nodejs.org/dist/$nodeVersion/node-$nodeVersion-win-x64.zip"
$zipPath = "$env:RUNNER_TEMP\node.zip"
$extractRoot = "$env:RUNNER_TEMP\node"
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
Expand-Archive -Path $zipPath -DestinationPath $extractRoot -Force
$nodeDir = Get-ChildItem -Path $extractRoot -Directory | Select-Object -First 1
if (-not $nodeDir) {
throw "Node.js archive extracted incorrectly."
}
$nodeDir.FullName | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
$env:PATH = "$($nodeDir.FullName);$env:PATH"
node --version
- name: Checkout
uses: https://git.daemonlord.ru/actions/checkout@v4
with:
fetch-depth: 0
tags: true
- name: Set up Python
uses: https://git.daemonlord.ru/actions/setup-python@v5
with:
python-version: "3.13"
- 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