Build & Release EXE #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build & Release EXE | |
| # Tag-driven release: pushing a tag like `v2.1.1` builds the desktop EXE | |
| # on Windows and uploads it to the GitHub release for that tag. If the | |
| # release doesn't exist yet, the job creates it with auto-generated | |
| # notes from the git log. | |
| # | |
| # `workflow_dispatch` lets you re-run the build for any existing tag | |
| # (e.g. to (re)attach an EXE to a release that was published as | |
| # source-only). | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Tag to build for (must already exist as a release, e.g. v2.1.0)' | |
| required: true | |
| jobs: | |
| build: | |
| runs-on: windows-latest | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Resolve tag | |
| id: tag | |
| shell: bash | |
| run: | | |
| if [ -n "${{ github.event.inputs.tag }}" ]; then | |
| echo "value=${{ github.event.inputs.tag }}" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "value=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: ${{ steps.tag.outputs.value }} | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.11' | |
| cache: 'pip' | |
| - name: Install build dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pyinstaller | |
| - name: Build EXE | |
| # AlertNative.spec = the native PySide6 build (no QtWebEngine). The old | |
| # AlertCreator.spec built the web/QtWebEngine exe, which is what kept | |
| # clobbering manually-uploaded native builds on every tag push. | |
| run: python -m PyInstaller --clean --noconfirm AlertNative.spec | |
| - name: Verify build artifact | |
| shell: bash | |
| run: | | |
| if [ ! -f dist/alert-alert.exe ]; then | |
| echo "Expected dist/alert-alert.exe was not produced." >&2 | |
| ls -la dist/ || true | |
| exit 1 | |
| fi | |
| ls -lh dist/alert-alert.exe | |
| - name: Upload to release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ steps.tag.outputs.value }} | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if ! gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then | |
| echo "Release $TAG does not exist yet — creating with auto-generated notes." | |
| gh release create "$TAG" \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --title "$TAG" \ | |
| --generate-notes | |
| fi | |
| gh release upload "$TAG" dist/alert-alert.exe \ | |
| --repo "$GITHUB_REPOSITORY" \ | |
| --clobber |