|
| 1 | +name: Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - "v*" |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write # required for gh release create |
| 10 | + |
| 11 | +jobs: |
| 12 | + release: |
| 13 | + name: build and publish (windows / py3.12) |
| 14 | + runs-on: windows-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + |
| 18 | + - uses: actions/setup-python@v5 |
| 19 | + with: |
| 20 | + python-version: "3.12" |
| 21 | + cache: pip |
| 22 | + |
| 23 | + - name: Install dependencies |
| 24 | + run: | |
| 25 | + python -m pip install --upgrade pip |
| 26 | + pip install -r requirements.txt -r requirements-build.txt |
| 27 | +
|
| 28 | + # Gate the release on the same test suite CI runs — never ship a broken build. |
| 29 | + - name: Run tests |
| 30 | + env: |
| 31 | + QT_QPA_PLATFORM: offscreen |
| 32 | + run: python -m unittest discover -s tests -v |
| 33 | + |
| 34 | + - name: Build executable |
| 35 | + run: python -m PyInstaller --noconfirm --clean screamer.spec |
| 36 | + |
| 37 | + # screamer.spec uses COLLECT (onedir), so the artifact is the dist\Screamer |
| 38 | + # folder zipped whole — users extract it and run Screamer\Screamer.exe. |
| 39 | + - name: Package |
| 40 | + shell: pwsh |
| 41 | + run: | |
| 42 | + $tag = $env:GITHUB_REF_NAME |
| 43 | + $zip = "Screamer-$tag-windows-x64.zip" |
| 44 | + Compress-Archive -Path dist\Screamer -DestinationPath $zip |
| 45 | + $hash = (Get-FileHash $zip -Algorithm SHA256).Hash.ToLower() |
| 46 | + "$hash $zip" | Out-File -FilePath "$zip.sha256" -Encoding ascii |
| 47 | + "ASSET_ZIP=$zip" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 48 | + "ASSET_SHA=$zip.sha256" | Out-File -FilePath $env:GITHUB_ENV -Append |
| 49 | +
|
| 50 | + # Hyphenated tags (v1.0.0-rc1, v1.2.0-beta) publish as pre-releases. |
| 51 | + - name: Publish release |
| 52 | + env: |
| 53 | + GH_TOKEN: ${{ github.token }} |
| 54 | + shell: pwsh |
| 55 | + run: | |
| 56 | + $tag = $env:GITHUB_REF_NAME |
| 57 | + $ghArgs = @( |
| 58 | + "release", "create", $tag, |
| 59 | + $env:ASSET_ZIP, $env:ASSET_SHA, |
| 60 | + "--title", $tag, |
| 61 | + "--generate-notes" |
| 62 | + ) |
| 63 | + if ($tag -match "-") { $ghArgs += "--prerelease" } |
| 64 | + & gh @ghArgs |
0 commit comments