-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (90 loc) · 3.74 KB
/
Copy pathrelease.yml
File metadata and controls
103 lines (90 loc) · 3.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Release
# Builds the portable zip, bare exe, and Inno Setup installer on Windows, then
# publishes them to a GitHub Release.
#
# Triggers automatically when src/_version.py changes on main (i.e. when you bump
# the version), creating the matching v<version> tag + release. You can also run
# it manually from the Actions tab ("Run workflow"). If a release for the current
# version already exists, the build is skipped, so re-touching the file is safe.
on:
push:
branches: [main]
paths:
- "src/_version.py"
workflow_dispatch:
permissions:
contents: write # required to create the release + tag
jobs:
build:
runs-on: windows-latest
# Force UTF-8 for Python stdout — the runner defaults to cp1252, which can't
# encode non-Latin-1 output (emoji, etc.) from the build scripts.
env:
PYTHONUTF8: "1"
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Read version from src/_version.py
id: ver
shell: pwsh
run: |
$v = (Select-String -Path src/_version.py -Pattern '__version__\s*=\s*"([^"]+)"').Matches.Groups[1].Value
if (-not $v) { Write-Error "Could not parse __version__ from src/_version.py"; exit 1 }
"version=$v" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Version is $v"
- name: Skip if this version is already released
id: check
shell: pwsh
env:
GH_TOKEN: ${{ github.token }}
run: |
$tag = "v${{ steps.ver.outputs.version }}"
gh release view $tag --repo "${{ github.repository }}" *> $null
$exists = $LASTEXITCODE -eq 0
$global:LASTEXITCODE = 0 # gh returns 1 when not found; don't fail the step
if ($exists) {
"exists=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "::notice::Release $tag already exists, skipping build."
} else {
"exists=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
Write-Host "Building release $tag"
}
exit 0
- name: Set up Python
if: steps.check.outputs.exists == 'false'
uses: actions/setup-python@v6
with:
# Matches the dev/build interpreter so CI reproduces your known-good
# local build. If a dependency lacks a 3.14 wheel on the runner and the
# build fails, drop this to "3.12" (PyInstaller bundles whichever it uses).
python-version: "3.14"
- name: Set up Node
if: steps.check.outputs.exists == 'false'
uses: actions/setup-node@v6
with:
node-version: "20"
- name: Install Inno Setup
if: steps.check.outputs.exists == 'false'
run: choco install innosetup --no-progress -y
- name: Install Python dependencies
if: steps.check.outputs.exists == 'false'
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pyinstaller
- name: Build release artifacts
if: steps.check.outputs.exists == 'false'
run: python scripts/build_release.py
- name: Publish GitHub Release
if: steps.check.outputs.exists == 'false'
uses: softprops/action-gh-release@v3
with:
tag_name: v${{ steps.ver.outputs.version }}
name: queuePop v${{ steps.ver.outputs.version }}
# Curated, player-facing notes — RELEASE_NOTES.md is rewritten each
# release and doubles as the in-app Release Notes content.
body_path: RELEASE_NOTES.md
files: |
releases/queuePop-v${{ steps.ver.outputs.version }}-setup.exe
releases/queuePop-v${{ steps.ver.outputs.version }}-portable.zip
releases/queuePop.exe