Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/electron-passkeys.yml

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saved as .template so we don't run this action yet

Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Electron Passkeys Native Build

on:
workflow_dispatch:
pull_request:
paths:
- 'packages/electron-passkeys/**'
- '.github/workflows/electron-passkeys.yml'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
settings:
- host: macos-14
target: aarch64-apple-darwin
- host: macos-14
target: x86_64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: windows-latest
target: aarch64-pc-windows-msvc
defaults:
run:
working-directory: packages/electron-passkeys
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24

- uses: pnpm/action-setup@v4

- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.settings.target }}

- uses: Swatinem/rust-cache@v2
with:
workspaces: packages/electron-passkeys

- name: Install dependencies
run: pnpm install --filter @clerk/electron-passkeys... --frozen-lockfile --ignore-scripts
working-directory: .

- name: Build native module
run: pnpm build --target ${{ matrix.settings.target }}

- name: Smoke test (host-native targets only)
if: matrix.settings.target == 'aarch64-apple-darwin' || matrix.settings.target == 'x86_64-pc-windows-msvc'
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');"

- uses: actions/upload-artifact@v4
with:
name: bindings-${{ matrix.settings.target }}
path: packages/electron-passkeys/electron-passkeys.*.node
if-no-files-found: error

package:
name: Assemble platform packages
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
working-directory: packages/electron-passkeys
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 24

- uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --filter @clerk/electron-passkeys... --frozen-lockfile --ignore-scripts
working-directory: .

- uses: actions/download-artifact@v4
with:
path: packages/electron-passkeys/artifacts

- name: Move binaries into per-platform npm packages
run: pnpm artifacts

- name: Verify every platform package contains its binary
run: |
for dir in npm/*/; do
count=$(find "$dir" -name '*.node' | wc -l)
if [ "$count" -ne 1 ]; then
echo "::error::$dir is missing its .node binary — publishing it would ship an empty package"
exit 1
fi
(cd "$dir" && npm pack --dry-run)
done
6 changes: 6 additions & 0 deletions packages/electron-passkeys/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
target/
*.node
artifacts/
# napi-generated type defs for the raw native binding (the public surface is
# the hand-written index.js/index.d.ts loader)
native.d.ts
Loading
Loading