|
| 1 | +name: Electron Passkeys Native Build |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + |
| 6 | +concurrency: |
| 7 | + group: electron-passkeys-${{ github.head_ref || github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | + |
| 10 | +permissions: |
| 11 | + contents: read |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + name: Build ${{ matrix.settings.target }} |
| 16 | + runs-on: ${{ matrix.settings.host }} |
| 17 | + timeout-minutes: 30 |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + settings: |
| 22 | + - host: macos-14 |
| 23 | + target: aarch64-apple-darwin |
| 24 | + - host: macos-14 |
| 25 | + target: x86_64-apple-darwin |
| 26 | + - host: windows-latest |
| 27 | + target: x86_64-pc-windows-msvc |
| 28 | + - host: windows-latest |
| 29 | + target: aarch64-pc-windows-msvc |
| 30 | + defaults: |
| 31 | + run: |
| 32 | + working-directory: packages/electron-passkeys |
| 33 | + steps: |
| 34 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 35 | + with: |
| 36 | + persist-credentials: false |
| 37 | + |
| 38 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 39 | + with: |
| 40 | + node-version: 24 |
| 41 | + |
| 42 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 43 | + |
| 44 | + - uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable |
| 45 | + with: |
| 46 | + toolchain: stable |
| 47 | + targets: ${{ matrix.settings.target }} |
| 48 | + |
| 49 | + - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 |
| 50 | + with: |
| 51 | + workspaces: packages/electron-passkeys |
| 52 | + |
| 53 | + - name: Install dependencies |
| 54 | + run: pnpm install --filter @clerk/electron-passkeys... --frozen-lockfile --ignore-scripts |
| 55 | + working-directory: . |
| 56 | + |
| 57 | + - name: Build native module |
| 58 | + run: pnpm build:native --target ${{ matrix.settings.target }} |
| 59 | + |
| 60 | + - name: Smoke test (host-native targets only) |
| 61 | + if: matrix.settings.target == 'aarch64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc' |
| 62 | + run: node -e "const m = require('./index.js'); console.log('isAvailable:', m.isAvailable(), 'capabilities:', JSON.stringify(m.capabilities())); if (!m.isAvailable()) throw new Error('the loader did not find the freshly built native binary');" |
| 63 | + |
| 64 | + - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 65 | + with: |
| 66 | + name: bindings-${{ matrix.settings.target }} |
| 67 | + path: packages/electron-passkeys/electron-passkeys.*.node |
| 68 | + if-no-files-found: error |
| 69 | + |
| 70 | + package: |
| 71 | + name: Assemble platform packages |
| 72 | + needs: build |
| 73 | + runs-on: blacksmith-8vcpu-ubuntu-2204 |
| 74 | + timeout-minutes: 10 |
| 75 | + defaults: |
| 76 | + run: |
| 77 | + working-directory: packages/electron-passkeys |
| 78 | + steps: |
| 79 | + - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
| 80 | + with: |
| 81 | + persist-credentials: false |
| 82 | + |
| 83 | + - uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4 |
| 84 | + with: |
| 85 | + node-version: 24 |
| 86 | + |
| 87 | + - uses: pnpm/action-setup@b906affcce14559ad1aafd4ab0e942779e9f58b1 # v4 |
| 88 | + |
| 89 | + - name: Install dependencies |
| 90 | + run: pnpm install --filter @clerk/electron-passkeys... --frozen-lockfile --ignore-scripts |
| 91 | + working-directory: . |
| 92 | + |
| 93 | + - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 |
| 94 | + with: |
| 95 | + path: packages/electron-passkeys/artifacts |
| 96 | + |
| 97 | + - name: Move binaries into per-platform npm packages |
| 98 | + run: pnpm artifacts |
| 99 | + |
| 100 | + - name: Verify every platform package contains its binary |
| 101 | + run: node scripts/check-electron-passkeys-binaries.mjs packages/electron-passkeys/npm |
| 102 | + working-directory: . |
| 103 | + |
| 104 | + - name: Upload assembled platform binaries |
| 105 | + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 |
| 106 | + with: |
| 107 | + name: electron-passkeys-npm |
| 108 | + path: packages/electron-passkeys/npm/**/*.node |
| 109 | + if-no-files-found: error |
| 110 | + retention-days: 90 |
0 commit comments