Phase 6g: add publish-nodejs to release.yml (npm via OIDC)#28
Merged
Conversation
Two new jobs following the Phase 6f pattern:
- build-nodejs-binaries (matrix, 4 cells)
- publish-nodejs (aggregate + npm publish + GitHub Release)
**Bundled-binaries architecture**: the `sqlrite` npm package ships
every platform's `.node` binary inside one tarball (~15 MiB),
picked at require time by napi's generated `index.js` dispatcher
based on process.platform / process.arch. Simpler than managing
N+1 npm packages (main + one per platform) — the cost is a bigger
download, acceptable for a database driver people install once.
**Why build/publish split**: same reason as publish-python — if
each matrix cell ran `npm publish` independently, a mid-matrix
failure would leave npm with some-but-not-all binaries and no
clean rollback. Aggregator downloads every platform's `.node`
binary into sdk/nodejs/ alongside the napi-generated `index.js`
dispatcher (uploaded by the Linux x86_64 cell only — it's
identical across build platforms), then does one atomic
`npm publish --provenance`.
**Matrix** mirrors publish-ffi / publish-desktop / publish-python
so all publish jobs share one consistent OS/arch pattern:
ubuntu-latest → linux-x64-gnu (sqlrite.linux-x64-gnu.node)
ubuntu-24.04-arm → linux-arm64-gnu (sqlrite.linux-arm64-gnu.node)
macos-latest → darwin-arm64 (sqlrite.darwin-arm64.node)
windows-latest → win32-x64-msvc (sqlrite.win32-x64-msvc.node)
**Authentication via npm OIDC trusted publishing** — zero
long-lived NPM_TOKEN. The publish-nodejs job has `permissions:
id-token: write` and lives in the `release` GitHub environment.
npm-side config is one-time trusted-publisher registration on
npmjs.com (docs/release-secrets.md). `--provenance` flag attaches
a sigstore-signed attestation linking the published package to
this exact GitHub Actions run — npm's equivalent of PyPI's
PEP 740 attestations that worked first-try in the v0.1.4 canary.
**Wiring:**
- tag-all → pushes sqlrite-node-v<V>
- finalize → needs publish-nodejs
- umbrella release body → 🟢 Node.js link with npm + per-product
release pointers
Verified locally: `cargo check -p sqlrite-nodejs` clean,
release.yml parses as valid YAML, npm name `sqlrite` available
(404 on registry.npmjs.org). Existing package.json already names
it `sqlrite` and has the `sqlrite.*.node` glob in `files`, so no
SDK source changes needed.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds two new jobs to
release.ymlthat build + publish thesqlriteNode.js package to npm on every release, authenticating via OIDC trusted publishing (noNPM_TOKEN).build-nodejs-binaries.nodebinariespublish-nodejsnpm publish --provenance, cutsqlrite-node-v<V>GitHub ReleaseBundled-binaries architecture
The main
sqlritenpm package ships every platform's.nodebinary inside one tarball (~15 MiB). napi-rs's generatedindex.jspicks the right one atrequiretime viaprocess.platform+process.arch. The alternative — an@sqlrite/linux-x64-gnu+@sqlrite/darwin-arm64+ ... optional-deps pattern used by@napi-rs/*,sharp,@swc/core— is more efficient (users download only the one binary they need) but means maintaining N+1 npm packages. For an MVP, one package beats five. We can always pivot later without a breaking change.Why build/publish split (same pattern as Phase 6f)
If each matrix cell ran
npm publishindependently, a partial failure would put some-but-not-all binaries on npm with no clean rollback. Aggregator downloads all four.nodefiles intosdk/nodejs/alongside the napi-generatedindex.jsdispatcher (only the Linux x86_64 cell uploads that — it's identical across build platforms), then does onenpm publish --provenance.Matrix choices
Mirrors publish-ffi / publish-desktop / publish-python — one consistent OS/arch pattern across all publish jobs:
sqlrite.linux-x64-gnu.nodesqlrite.linux-arm64-gnu.nodesqlrite.darwin-arm64.nodesqlrite.win32-x64-msvc.nodeAuthentication + provenance
OIDC trusted publishing via
permissions: id-token: write+ thereleaseGitHub environment. ZeroNPM_TOKENanywhere.The
--provenanceflag attaches a sigstore-signed attestation linking the published package to this exact GitHub Actions workflow run. Users can verify it withnpm audit signatures. This is npm's equivalent of the PEP 740 attestations that worked first-try in the v0.1.4 canary (see the.publish.attestationfiles on sqlrite-py-v0.1.4).Wiring
tag-all→ now pushessqlrite-node-v<V>finalize.needs→ extended withpublish-nodejsName availability
sqlriteis available on npm —curl -o /dev/null -w "%{http_code}" https://registry.npmjs.org/sqlritereturns 404.package.jsonalready hasname: "sqlrite", no rename dance needed.Test plan
cargo check -p sqlrite-nodejs— cleanpython3 -c "import yaml; yaml.safe_load(open('.github/workflows/release.yml'))"— YAML parsesnodejs-sdkmatrix jobs re-exercise the SDK)sqlritepackage name by configuring a trusted publisher pointing at this repo /release.yml/ environmentrelease. Documented indocs/release-secrets.md.release-pr.ymlat0.1.5→ review → merge → approvereleaseenv gates (now 10 total: 1 crate + 4 ffi + 3 desktop + 1 python + 1 nodejs) → verifysqlrite 0.1.5on npm +sqlrite-node-v0.1.5GitHub Release.Not in scope
sqlrite-wasm)Each lands as its own PR.
🤖 Generated with Claude Code