Add Inno Setup installer and tag-triggered release workflow #1
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-release: | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Extract version from resource.h (source of truth) | |
| id: version | |
| shell: pwsh | |
| run: | | |
| $rc = Get-Content res/resource.h -Raw | |
| if ($rc -notmatch 'SHAKETOZOOM_VERSION_STR\s+"([\d.]+)"') { | |
| Write-Error "Could not find SHAKETOZOOM_VERSION_STR in res/resource.h" | |
| exit 1 | |
| } | |
| $version = $Matches[1] | |
| Write-Host "Resolved version from resource.h: $version" | |
| "version=$version" >> $env:GITHUB_OUTPUT | |
| - name: Validate git tag matches resource.h version | |
| shell: pwsh | |
| run: | | |
| $tag = "${{ github.ref_name }}" -replace '^v','' | |
| $rcVersion = "${{ steps.version.outputs.version }}" | |
| if ($tag -ne $rcVersion) { | |
| Write-Error "Tag 'v$tag' does not match SHAKETOZOOM_VERSION_STR ('$rcVersion') in res/resource.h. Bump the version in resource.h before tagging a release." | |
| exit 1 | |
| } | |
| - name: Setup MSVC environment | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: x64 | |
| - name: Configure (CMake + Ninja) | |
| run: cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release | |
| - name: Build | |
| run: cmake --build build --config Release | |
| - name: Compile installer with Inno Setup | |
| shell: pwsh | |
| run: | | |
| & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" ` | |
| "/DMyAppVersion=${{ steps.version.outputs.version }}" ` | |
| installer\ShakeToZoom.iss | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| generate_release_notes: true | |
| files: | | |
| build/ShakeToZoom.exe | |
| build/installer/ShakeToZoomSetup-${{ steps.version.outputs.version }}.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |