|
| 1 | +name: Desktop Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: ['desktop-v*'] |
| 6 | + workflow_dispatch: {} |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: write |
| 10 | + |
| 11 | +concurrency: |
| 12 | + group: desktop-release-${{ github.ref }} |
| 13 | + cancel-in-progress: false |
| 14 | + |
| 15 | +jobs: |
| 16 | + mac: |
| 17 | + runs-on: macos-15 |
| 18 | + steps: |
| 19 | + - name: Checkout |
| 20 | + uses: actions/checkout@v4 |
| 21 | + with: |
| 22 | + fetch-depth: 0 |
| 23 | + persist-credentials: true |
| 24 | + |
| 25 | + - uses: pnpm/action-setup@v6 |
| 26 | + |
| 27 | + - uses: actions/setup-node@v6 |
| 28 | + with: |
| 29 | + node-version-file: .nvmrc |
| 30 | + cache: pnpm |
| 31 | + |
| 32 | + - run: pnpm install --frozen-lockfile |
| 33 | + |
| 34 | + - name: Stamp desktop version for tag builds |
| 35 | + if: startsWith(github.ref, 'refs/tags/desktop-v') |
| 36 | + env: |
| 37 | + TAG_NAME: ${{ github.ref_name }} |
| 38 | + run: | |
| 39 | + export DESKTOP_VERSION="${TAG_NAME#desktop-v}" |
| 40 | + node -e 'const fs = require("node:fs"); const path = "apps/desktop/package.json"; const packageJson = JSON.parse(fs.readFileSync(path, "utf8")); packageJson.version = process.env.DESKTOP_VERSION; fs.writeFileSync(path, `${JSON.stringify(packageJson, null, 2)}\n`);' |
| 41 | +
|
| 42 | + - name: Build workspace |
| 43 | + run: pnpm --workspace-root run build |
| 44 | + |
| 45 | + - name: Stage desktop runtime |
| 46 | + working-directory: apps/desktop |
| 47 | + run: node --import tsx scripts/stage-runtime.ts |
| 48 | + |
| 49 | + # On a desktop-v* tag, --publish always creates or updates the draft-or-release |
| 50 | + # for that tag; contents: write makes GITHUB_TOKEN sufficient. |
| 51 | + # Without Developer ID signing secrets, electron-builder publishes an |
| 52 | + # ad-hoc/self-signed app. macOS auto-update will not accept unsigned updates, |
| 53 | + # but this still proves packaging and the feed shape. |
| 54 | + - name: Package and publish desktop release |
| 55 | + working-directory: apps/desktop |
| 56 | + run: pnpm exec electron-builder --mac dmg zip --publish always |
| 57 | + env: |
| 58 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 59 | + CSC_LINK: ${{ secrets.MAC_CSC_LINK }} |
| 60 | + CSC_KEY_PASSWORD: ${{ secrets.MAC_CSC_KEY_PASSWORD }} |
| 61 | + APPLE_ID: ${{ secrets.APPLE_ID }} |
| 62 | + APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} |
| 63 | + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} |
| 64 | + |
| 65 | + - name: Upload macOS artifacts for manual runs |
| 66 | + if: github.event_name == 'workflow_dispatch' |
| 67 | + uses: actions/upload-artifact@v7 |
| 68 | + with: |
| 69 | + name: desktop-macos |
| 70 | + path: | |
| 71 | + apps/desktop/dist/*.dmg |
| 72 | + apps/desktop/dist/*.zip |
| 73 | + apps/desktop/dist/latest-mac.yml |
| 74 | + if-no-files-found: error |
0 commit comments