Release #3
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
| # Keyper - Release Build Workflow | |
| # Made by Pink Pixel | |
| # | |
| # Triggers on any tag that looks like a version ie. v1.0.0, etc. | |
| # Can also be triggered manually via workflow_dispatch. | |
| # | |
| # Produces: | |
| # • Windows → NSIS installer (.exe) — built on windows-latest | |
| # | |
| # Linux builds (AppImage + .deb) are built locally and uploaded manually. | |
| # | |
| # Create a release like this to trigger it: | |
| # git tag v1.0.0 && git push origin v1.0.0 | |
| # (then create the Release on GitHub, or use the gh CLI) | |
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: "Release tag to upload to (e.g. v1.0.0)" | |
| required: true | |
| ref: | |
| description: "Git ref to build from for manual runs (branch, tag, or SHA)" | |
| required: false | |
| default: "main" | |
| permissions: | |
| contents: write # needed to upload release assets | |
| env: | |
| RELEASE_TAG: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref_name }} | |
| BUILD_REF: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref }} | |
| jobs: | |
| # ── Windows installer (.exe) ──────────────────────────────────────────────── | |
| build-windows: | |
| name: Windows installer | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ env.BUILD_REF }} | |
| fetch-depth: 0 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: package-lock.json | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Vite app | |
| run: npm run build | |
| - name: Compile Electron main process | |
| run: npm run electron:compile | |
| - name: Prepare release metadata | |
| id: release_meta | |
| shell: pwsh | |
| run: | | |
| $releaseTag = "${{ env.RELEASE_TAG }}" | |
| $releaseVersion = $releaseTag -replace '^v', '' | |
| "release_tag=$releaseTag" >> $env:GITHUB_OUTPUT | |
| "release_version=$releaseVersion" >> $env:GITHUB_OUTPUT | |
| - name: Package Windows installer | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| CI: "true" | |
| run: | | |
| npx electron-builder ` | |
| --win ` | |
| --publish never ` | |
| "--config.extraMetadata.version=${{ steps.release_meta.outputs.release_version }}" ` | |
| "--config.win.artifactName=Keyper Setup ${{ steps.release_meta.outputs.release_tag }}-win-x64.exe" | |
| - name: Verify installer output | |
| shell: pwsh | |
| run: | | |
| $installers = Get-ChildItem -Path dist-electron -Filter '*Setup*.exe' -File | |
| if ($installers.Count -eq 0) { | |
| Write-Error 'No NSIS installer was generated under dist-electron/.' | |
| } | |
| $installers | ForEach-Object { Write-Host "Installer: $($_.FullName)" } | |
| - name: Upload installer artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-installer | |
| path: | | |
| dist-electron/*Setup*.exe | |
| - name: Upload to GitHub Release | |
| if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| $installers = Get-ChildItem -Path dist-electron -Filter '*Setup*.exe' -File | Select-Object -ExpandProperty FullName | |
| if ($installers.Count -eq 0) { | |
| Write-Error 'No installer files were found to upload.' | |
| } | |
| gh release upload "${{ steps.release_meta.outputs.release_tag }}" $installers --clobber |