Compare commits
8 Commits
v2.0.0-b30
...
v2.0.0
| Author | SHA1 | Date | |
|---|---|---|---|
| 147988242f | |||
| cf6d6bcbd0 | |||
| 61948a51c6 | |||
| 97c52c5a51 | |||
| 862c2c8899 | |||
| 1013a1ce38 | |||
| f15e71996b | |||
| 34272d01c8 |
@@ -28,8 +28,8 @@ jobs:
|
||||
|
||||
- name: Validate syntax
|
||||
run: |
|
||||
python -m py_compile app_version.py main.py build.py tests/test_auth_relogin_smoke.py
|
||||
python -m py_compile app_version.py main.py build.py tests/test_auth_relogin_smoke.py tests/test_auto_update_service.py tests/test_chat_actions.py tests/test_token_store.py
|
||||
|
||||
- name: Run tests
|
||||
run: |
|
||||
python -m unittest tests/test_auth_relogin_smoke.py
|
||||
python -m unittest discover -s tests -p "test_*.py" -v
|
||||
|
||||
@@ -1,148 +0,0 @@
|
||||
name: Desktop Dev Pre-release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- dev
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
prerelease:
|
||||
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: powershell
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install -r requirements.txt pyinstaller
|
||||
|
||||
- name: Extract prerelease metadata
|
||||
id: meta
|
||||
shell: powershell
|
||||
run: |
|
||||
$version = (python -c "from app_version import APP_VERSION; print(APP_VERSION)").Trim()
|
||||
$commit = (git rev-parse --short HEAD).Trim()
|
||||
$tag = "v$version-$commit"
|
||||
$archive = "AnabasisManager-$version-$commit"
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version=$version`n", $utf8NoBom)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "commit=$commit`n", $utf8NoBom)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "tag=$tag`n", $utf8NoBom)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "archive=$archive`n", $utf8NoBom)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=true`n", $utf8NoBom)
|
||||
Write-Host "Detected tag: $tag"
|
||||
|
||||
- name: Stop if prerelease already exists
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
$tag = "${{ steps.meta.outputs.tag }}"
|
||||
$apiUrl = "https://git.daemonlord.ru/api/v1/repos/${{ gitea.repository }}/releases?page=1&limit=100"
|
||||
$headers = @{ Authorization = "token ${{ secrets.API_TOKEN }}" }
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Get
|
||||
$found = $false
|
||||
foreach ($release in $response) {
|
||||
if ($release.tag_name -eq $tag) {
|
||||
$found = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
if ($found) {
|
||||
Write-Host "Pre-release $tag already exists, stopping job."
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=false`n", $utf8NoBom)
|
||||
} else {
|
||||
Write-Host "Pre-release $tag not found, continuing workflow..."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to query releases list, continuing workflow..."
|
||||
}
|
||||
|
||||
- name: Run tests
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
python -m py_compile app_version.py main.py build.py updater_gui.py tests/test_auth_relogin_smoke.py tests/test_auto_update_service.py tests/test_chat_actions.py tests/test_token_store.py
|
||||
python -m unittest discover -s tests -p "test_*.py" -v
|
||||
|
||||
- name: Build release zip
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
python build.py
|
||||
|
||||
- name: Prepare prerelease artifacts
|
||||
if: env.CONTINUE == 'true'
|
||||
shell: powershell
|
||||
run: |
|
||||
$version = "${{ steps.meta.outputs.version }}"
|
||||
$archiveBase = "${{ steps.meta.outputs.archive }}"
|
||||
$srcZip = "dist/AnabasisManager-$version.zip"
|
||||
$dstZip = "dist/$archiveBase.zip"
|
||||
if (-not (Test-Path $srcZip)) {
|
||||
throw "Archive not found: $srcZip"
|
||||
}
|
||||
Copy-Item -Path $srcZip -Destination $dstZip -Force
|
||||
$hash = (Get-FileHash -Path $dstZip -Algorithm SHA256).Hash.ToLower()
|
||||
"$hash $archiveBase.zip" | Set-Content -Path "dist/$archiveBase.zip.sha256" -Encoding UTF8
|
||||
|
||||
- name: Configure git identity
|
||||
if: env.CONTINUE == 'true'
|
||||
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: powershell
|
||||
run: |
|
||||
$tag = "${{ steps.meta.outputs.tag }}"
|
||||
$tagLine = (git ls-remote --tags origin "refs/tags/$tag" | Select-Object -First 1)
|
||||
if ([string]::IsNullOrWhiteSpace($tagLine)) {
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
} else {
|
||||
Write-Host "Tag $tag already exists on origin, skipping tag push."
|
||||
}
|
||||
|
||||
- name: Create Gitea Pre-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.meta.outputs.tag }}
|
||||
name: Anabasis Manager ${{ steps.meta.outputs.version }} (dev ${{ steps.meta.outputs.commit }})
|
||||
prerelease: true
|
||||
body: |
|
||||
Development pre-release for commit ${{ steps.meta.outputs.commit }}
|
||||
Version base: ${{ steps.meta.outputs.version }}
|
||||
files: |
|
||||
dist/${{ steps.meta.outputs.archive }}.zip
|
||||
dist/${{ steps.meta.outputs.archive }}.zip.sha256
|
||||
@@ -47,31 +47,47 @@ jobs:
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_OUTPUT, "version=$version`n", $utf8NoBom)
|
||||
Write-Host "Detected version: $version"
|
||||
|
||||
- name: Stop if version already released
|
||||
id: stop
|
||||
- name: Initialize release flow
|
||||
id: flow_init
|
||||
shell: powershell
|
||||
run: |
|
||||
$utf8NoBom = New-Object System.Text.UTF8Encoding($false)
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=true`n", $utf8NoBom)
|
||||
exit 0
|
||||
|
||||
- name: Stop if release already exists
|
||||
shell: powershell
|
||||
run: |
|
||||
$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
|
||||
$apiUrl = "https://git.daemonlord.ru/api/v1/repos/${{ gitea.repository }}/releases?page=1&limit=100"
|
||||
$headers = @{ Authorization = "token ${{ secrets.API_TOKEN }}" }
|
||||
$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)
|
||||
try {
|
||||
$response = Invoke-RestMethod -Uri $apiUrl -Headers $headers -Method Get
|
||||
$found = $false
|
||||
foreach ($release in $response) {
|
||||
if ($release.tag_name -eq $tag) {
|
||||
$found = $true
|
||||
break
|
||||
}
|
||||
}
|
||||
if ($found) {
|
||||
Write-Host "Release $tag already exists, stopping job."
|
||||
[System.IO.File]::AppendAllText($env:GITHUB_ENV, "CONTINUE=false`n", $utf8NoBom)
|
||||
} else {
|
||||
Write-Host "Release $tag not found, continuing workflow..."
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to query releases list, continuing workflow..."
|
||||
}
|
||||
exit 0
|
||||
|
||||
- name: Run tests
|
||||
if: env.CONTINUE == 'true'
|
||||
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
|
||||
python -m py_compile app_version.py main.py build.py tests/test_auth_relogin_smoke.py tests/test_auto_update_service.py tests/test_chat_actions.py tests/test_token_store.py
|
||||
python -m unittest discover -s tests -p "test_*.py" -v
|
||||
|
||||
- name: Build release zip
|
||||
if: env.CONTINUE == 'true'
|
||||
@@ -114,8 +130,13 @@ jobs:
|
||||
run: |
|
||||
$version = "${{ steps.extract_version.outputs.version }}"
|
||||
$tag = "v$version"
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
$tagLine = (git ls-remote --tags origin "refs/tags/$tag" | Select-Object -First 1)
|
||||
if ([string]::IsNullOrWhiteSpace($tagLine)) {
|
||||
git tag "$tag"
|
||||
git push origin "$tag"
|
||||
} else {
|
||||
Write-Host "Tag $tag already exists on origin, skipping tag push."
|
||||
}
|
||||
|
||||
- name: Create Gitea Release
|
||||
if: env.CONTINUE == 'true'
|
||||
|
||||
Reference in New Issue
Block a user