125 lines
3.8 KiB
YAML
125 lines
3.8 KiB
YAML
name: Desktop Release
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: windows
|
|
|
|
steps:
|
|
- name: Ensure Node.js for Gitea actions
|
|
shell: cmd
|
|
run: |
|
|
where node
|
|
if %ERRORLEVEL% EQU 0 (
|
|
node --version
|
|
exit /b 0
|
|
)
|
|
set "NODE_VERSION=v20.19.0"
|
|
set "ZIP_URL=https://nodejs.org/dist/%NODE_VERSION%/node-%NODE_VERSION%-win-x64.zip"
|
|
set "ZIP_PATH=%RUNNER_TEMP%\node.zip"
|
|
set "EXTRACT_ROOT=%RUNNER_TEMP%\node"
|
|
mkdir "%EXTRACT_ROOT%"
|
|
curl.exe -fsSL "%ZIP_URL%" -o "%ZIP_PATH%"
|
|
tar -xf "%ZIP_PATH%" -C "%EXTRACT_ROOT%"
|
|
for /d %%D in ("%EXTRACT_ROOT%\*") do (
|
|
set "NODE_DIR=%%~fD"
|
|
goto :node_found
|
|
)
|
|
echo Node.js archive extracted incorrectly.
|
|
exit /b 1
|
|
:node_found
|
|
echo %NODE_DIR%>>"%GITHUB_PATH%"
|
|
set "PATH=%NODE_DIR%;%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
|