Skip to content

ci(release): publish via npm trusted publishing - #21

Merged
amix merged 2 commits into
mainfrom
amix/npm-trusted-publishing
Nov 10, 2026
Merged

amix merged 2 commits into
mainfrom
amix/npm-trusted-publishing

Conversation

@amix

@amix amix commented Nov 10, 2026 •

Copy link
Copy Markdown
Owner

Context

  • The 0.16.0 tag release failed at publish: the npm environment's NPM_TOKEN returns 401.
  • npm now requires 2FA for direct publishing, so a replacement token would hit the same wall. 0.16.0 was published by hand.

What was changed

  • Publish job uses npm trusted publishing: id-token: write, npm 11.21.2 (needs 11.5.1+; Node 22 ships npm 10), no NPM_TOKEN / npm whoami step.
  • Platform packages now include repository. npm rejects the automatic provenance attestation without it.
  • publish-prebuilt-npm.ts inherits stdin so a local publish can answer npm's 2FA prompt (with stdin: "ignore" npm fails with EOTP).
  • CONTRIBUTING notes the per-package trusted publisher setup.

Before the next release

  • No more than 2 days before tagging (npm expires a trusted publisher that hasn't published within 2 days of creation), add one on npmjs.com to each of dunkdiff, dunkdiff-darwin-arm64, dunkdiff-darwin-x64, dunkdiff-linux-arm64, dunkdiff-linux-x64: repo amix/dunk, workflow release-prebuilt-npm.yml, environment npm, with npm publish allowed.
  • Then delete NPM_TOKEN from the npm environment.

Out of scope

  • The OIDC publish path can't run until the publishers exist; the first real test is the next tag.

amix added 2 commits November 10, 2026 09:46
…oken

The npm environment's NPM_TOKEN is rejected (401), and npm now requires 2FA
for direct publishing, so a replacement token would hit the same wall.

- Publish job requests an OIDC token (id-token: write) and installs npm
  11.21.2, since trusted publishing needs npm 11.5.1+ and Node 22 ships npm 10.
- Platform packages now carry `repository`; npm rejects the automatic
  provenance attestation when it is missing.
- The publish script inherits stdin so a local publish can answer npm's 2FA
  prompt; with stdin ignored, npm fails with EOTP before offering it.
@amix
amix marked this pull request as ready for review November 10, 2026 08:49
@amix
amix merged commit 148fb75 into main Nov 10, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant