fix: fall back to GitHub release page metadata #20
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 desktop applications | |
| on: | |
| push: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: windows | |
| os: windows-latest | |
| - name: linux | |
| os: ubuntu-latest | |
| - name: macos | |
| os: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm test | |
| - name: Package Windows application directory | |
| if: matrix.name == 'windows' | |
| run: npm run package:windows | |
| - name: Package Linux or macOS application | |
| if: matrix.name != 'windows' | |
| run: npm run package | |
| - name: Prepare Windows artifact names | |
| if: matrix.name == 'windows' | |
| id: windows-meta | |
| shell: pwsh | |
| run: | | |
| $package = Get-Content package.json -Raw | ConvertFrom-Json | |
| $timestamp = (Get-Date).ToUniversalTime().ToString("yyyyMMdd-HHmmss") | |
| $sha = "${{ github.sha }}".Substring(0, 12) | |
| $green = "SecAgent-green-$timestamp-$sha" | |
| $installer = "SecAgent-installer-$timestamp-$sha" | |
| $setup = "SecAgent-Setup-$timestamp-$sha" | |
| "appVersion=$($package.version)" >> $env:GITHUB_OUTPUT | |
| "timestamp=$timestamp" >> $env:GITHUB_OUTPUT | |
| "sha=$sha" >> $env:GITHUB_OUTPUT | |
| "green=$green" >> $env:GITHUB_OUTPUT | |
| "installer=$installer" >> $env:GITHUB_OUTPUT | |
| "setup=$setup" >> $env:GITHUB_OUTPUT | |
| - name: Build Inno Setup installer | |
| if: matrix.name == 'windows' | |
| uses: Minionguyjpro/Inno-Setup-Action@v1.2.9 | |
| with: | |
| path: installer/SecAgent.iss | |
| install_latest: true | |
| options: >- | |
| /DAppVersion=${{ steps.windows-meta.outputs.appVersion }} | |
| /DSourceDir=${{ github.workspace }}\release\win-unpacked | |
| /DOutputDir=${{ github.workspace }}\release\inno | |
| /DOutputBaseFilename=${{ steps.windows-meta.outputs.setup }} | |
| - name: Prepare Windows installer output | |
| if: matrix.name == 'windows' | |
| shell: pwsh | |
| run: | | |
| $innoOutput = Get-ChildItem -LiteralPath "release\inno" -Filter "*.exe" -File | |
| if ($innoOutput.Count -ne 1) { | |
| throw "Expected exactly one Inno Setup output EXE, found $($innoOutput.Count)" | |
| } | |
| $setup = Join-Path "release\inno" "${{ steps.windows-meta.outputs.setup }}.exe" | |
| if ($innoOutput[0].FullName -ne $setup) { | |
| Move-Item -LiteralPath $innoOutput[0].FullName -Destination $setup -Force | |
| } | |
| - name: Upload Linux or macOS artifact | |
| if: matrix.name != 'windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: secagent-${{ matrix.name }} | |
| path: release/ | |
| if-no-files-found: error | |
| - name: Upload Windows green artifact | |
| if: matrix.name == 'windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.windows-meta.outputs.green }} | |
| path: release/win-unpacked/ | |
| if-no-files-found: error | |
| - name: Upload Windows installer artifact | |
| if: matrix.name == 'windows' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ steps.windows-meta.outputs.installer }} | |
| path: release/inno/${{ steps.windows-meta.outputs.setup }}.exe | |
| if-no-files-found: error |