Release Desktop Apps #94
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 Desktop Apps | |
| on: | |
| push: | |
| tags: | |
| - 'v*.*.*' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/release.yml' | |
| - 'scripts/prepare-electron-resources.mjs' | |
| - 'scripts/build-empty-db.mjs' | |
| - 'scripts/smoke-electron-package.mjs' | |
| - 'scripts/smoke-windows-launch.mjs' | |
| - 'scripts/merge-mac-update-yml.mjs' | |
| - 'electron-builder.yml' | |
| - 'electron/builders/**' | |
| - 'package.json' | |
| - 'package-lock.json' | |
| - 'prisma/schema.prisma' | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| env: | |
| DATABASE_URL: "file:./prisma/ci.db" | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true" | |
| HYDRA_DATA_DIR: ".hydra-ci-data" | |
| JWT_SECRET: "ci-test-secret-32-characters-long" | |
| jobs: | |
| verify: | |
| name: lint, test, gate | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run lint | |
| - run: npm run build | |
| - run: npm run test:ci | |
| - run: npm run gate | |
| - run: npm run build | |
| build: | |
| name: ${{ matrix.name }} | |
| needs: verify | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # NOTE: release_glob lists each artifact AND the auto-update metadata | |
| # files electron-updater needs. Without latest-*.yml on the GitHub | |
| # release the running app's autoUpdater.checkForUpdates() will 404 | |
| # on the metadata URL — exact failure mode hit on v1.0.7. The arm64 | |
| # A follow-up mac-update-metadata job merges the arm64 and x64 | |
| # latest-mac.yml files after both packages smoke successfully. | |
| - name: macOS arm64 zip | |
| os: macos-14 | |
| build_target: darwin-arm64 | |
| target: --mac zip --arm64 | |
| artifact: | | |
| release/Hydra-*-mac-arm64.zip | |
| release/Hydra-*-mac-arm64.zip.blockmap | |
| release/latest-mac.yml | |
| release_glob: "release/Hydra-*-mac-arm64.zip release/Hydra-*-mac-arm64.zip.blockmap release/latest-mac.yml" | |
| - name: macOS Intel x64 zip | |
| os: macos-15-intel | |
| build_target: darwin-x64 | |
| target: --mac zip --x64 | |
| artifact: | | |
| release/Hydra-*-mac-x64.zip | |
| release/Hydra-*-mac-x64.zip.blockmap | |
| release/latest-mac.yml | |
| release_glob: "release/Hydra-*-mac-x64.zip release/Hydra-*-mac-x64.zip.blockmap" | |
| - name: Windows x64 NSIS | |
| os: windows-2022 | |
| build_target: win32-x64 | |
| target: --win nsis --x64 | |
| artifact: | | |
| release/Hydra-*-win-x64.exe | |
| release/*.blockmap | |
| release_glob: "release/Hydra-*-win-x64.exe release/*.blockmap release/latest.yml" | |
| - name: Linux x64 AppImage | |
| os: ubuntu-22.04 | |
| build_target: linux-x64 | |
| target: --linux AppImage --x64 | |
| artifact: | | |
| release/Hydra-*.AppImage | |
| release/latest-linux.yml | |
| release_glob: "release/Hydra-*.AppImage release/latest-linux.yml" | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Diagnostics | |
| shell: bash | |
| run: | | |
| echo "runner: ${{ matrix.os }} target: ${{ matrix.build_target }}" | |
| node --version | |
| npm --version | |
| - run: npm ci | |
| # Explicit Prisma client generate. electron-builder's afterPack hook | |
| # ships .prisma/client and asserts the platform engine is present; | |
| # making generate explicit here means a failure is attributed to this | |
| # step rather than getting buried inside electron:prepare or afterPack. | |
| - run: npx prisma generate | |
| - run: npm run build | |
| - run: npm run electron:prepare | |
| env: | |
| HYDRA_BUILD_TARGET: ${{ matrix.build_target }} | |
| - run: npx electron-builder ${{ matrix.target }} --publish never | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| HYDRA_SKIP_NOTARIZE: '1' | |
| - run: npm run electron:smoke | |
| env: | |
| HYDRA_BUILD_TARGET: ${{ matrix.build_target }} | |
| - name: Launch unpacked and NSIS-installed Windows executables | |
| if: matrix.build_target == 'win32-x64' | |
| run: npm run electron:smoke:win-launch | |
| - name: Upload verified artifacts to GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RELEASE_GLOB: ${{ matrix.release_glob }} | |
| run: | | |
| set -euo pipefail | |
| version="${GITHUB_REF_NAME#v}" | |
| notes_file="docs/releases/${version}.md" | |
| if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then | |
| if [ -f "$notes_file" ]; then | |
| gh release edit "$GITHUB_REF_NAME" --notes-file "$notes_file" | |
| fi | |
| elif [ -f "$notes_file" ]; then | |
| gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file "$notes_file" | |
| else | |
| gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes "" | |
| fi | |
| shopt -s nullglob | |
| files=() | |
| for pattern in $RELEASE_GLOB; do | |
| matches=( $pattern ) | |
| files+=( "${matches[@]}" ) | |
| done | |
| if [ "${#files[@]}" -eq 0 ]; then | |
| echo "No release artifacts matched: $RELEASE_GLOB" >&2 | |
| exit 1 | |
| fi | |
| gh release upload "$GITHUB_REF_NAME" "${files[@]}" --clobber | |
| - uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: ${{ matrix.name }} | |
| path: ${{ matrix.artifact }} | |
| if-no-files-found: warn | |
| mac-update-metadata: | |
| name: merge macOS updater metadata | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - run: npm ci | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macOS arm64 zip | |
| path: artifacts/mac-arm64 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: macOS Intel x64 zip | |
| path: artifacts/mac-x64 | |
| - name: Merge and upload latest-mac.yml | |
| shell: bash | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| set -euo pipefail | |
| node scripts/merge-mac-update-yml.mjs \ | |
| --out release/latest-mac.yml \ | |
| artifacts/mac-arm64/latest-mac.yml \ | |
| artifacts/mac-x64/latest-mac.yml | |
| grep -q 'mac-arm64.zip' release/latest-mac.yml | |
| grep -q 'mac-x64.zip' release/latest-mac.yml | |
| gh release upload "$GITHUB_REF_NAME" release/latest-mac.yml --clobber |