Compare commits
11 Commits
f9e0225243
...
v1.6.1
| Author | SHA1 | Date | |
|---|---|---|---|
| 2eb4c52b81 | |||
| 3d73a504d2 | |||
| 1524271be7 | |||
| 561cf43e09 | |||
| e8930f7550 | |||
| c8da0f9191 | |||
| 37ce500fd2 | |||
| 098a84e5bd | |||
| 5aa17c1a84 | |||
| dde14f3714 | |||
| fa5d4c6993 |
@@ -4,11 +4,10 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: windows-latest
|
||||
runs-on: windows
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -17,72 +16,94 @@ jobs:
|
||||
fetch-depth: 0
|
||||
tags: true
|
||||
|
||||
- name: Set up Python
|
||||
uses: https://git.daemonlord.ru/actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
- 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
|
||||
shell: powershell
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt pyinstaller
|
||||
|
||||
- name: Extract app version
|
||||
id: extract_version
|
||||
shell: bash
|
||||
shell: powershell
|
||||
run: |
|
||||
VERSION=$(python -c "from app_version import APP_VERSION; print(APP_VERSION)")
|
||||
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
|
||||
echo "Detected version: $VERSION"
|
||||
$version = (python -c "from app_version import APP_VERSION; print(APP_VERSION)").Trim()
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version=$version`n", $utf8NoBom)
|
||||
Write-Host "Detected version: $version"
|
||||
|
||||
- name: Stop if version already released
|
||||
id: stop
|
||||
shell: bash
|
||||
shell: powershell
|
||||
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
|
||||
$version = "${{ steps.extract_version.outputs.version }}"
|
||||
$tag = "v$version"
|
||||
git show-ref --tags --quiet --verify "refs/tags/$tag"
|
||||
$tagExists = ($LASTEXITCODE -eq 0)
|
||||
$global:LASTEXITCODE = 0
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
if ($tagExists) {
|
||||
Write-Host "Version $tag already released, stopping job."
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=false`n", $utf8NoBom)
|
||||
} else {
|
||||
Write-Host "Version $tag not released yet, continuing workflow..."
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=true`n", $utf8NoBom)
|
||||
}
|
||||
exit 0
|
||||
|
||||
- name: Run tests
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: bash
|
||||
shell: powershell
|
||||
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
|
||||
shell: powershell
|
||||
run: |
|
||||
python build.py
|
||||
|
||||
- name: Ensure archive exists
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: bash
|
||||
shell: powershell
|
||||
run: |
|
||||
VERSION="${{ steps.extract_version.outputs.version }}"
|
||||
test -f "dist/AnabasisManager-$VERSION.zip"
|
||||
$version = "${{ steps.extract_version.outputs.version }}"
|
||||
$archivePath = "dist/AnabasisManager-$version.zip"
|
||||
if (-not (Test-Path $archivePath)) {
|
||||
throw "Archive not found: $archivePath"
|
||||
}
|
||||
|
||||
- name: Configure git identity
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: bash
|
||||
shell: powershell
|
||||
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
|
||||
shell: powershell
|
||||
run: |
|
||||
VERSION="${{ steps.extract_version.outputs.version }}"
|
||||
git tag "$VERSION"
|
||||
git push origin "$VERSION"
|
||||
$version = "${{ steps.extract_version.outputs.version }}"
|
||||
$tag = "v$version"
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
|
||||
- name: Create Gitea Release
|
||||
if: env.CONTINUE == 'true'
|
||||
@@ -91,9 +112,9 @@ jobs:
|
||||
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 }}
|
||||
tag_name: v${{ steps.extract_version.outputs.version }}
|
||||
name: Anabasis Manager ${{ steps.extract_version.outputs.version }}
|
||||
body: |
|
||||
Desktop release ${{ steps.extract_version.outputs.version }}
|
||||
Desktop release v${{ steps.extract_version.outputs.version }}
|
||||
files: |
|
||||
dist/AnabasisManager-${{ steps.extract_version.outputs.version }}.zip
|
||||
|
||||
Reference in New Issue
Block a user