Repository navigation
ci: publish to npm via OIDC trusted publishing - #197
Merged
Merged
Conversation
Replace the legacy NPM_TOKEN auth (restricted by npm's 2FA-bypass policy) with OIDC trusted publishing. bun publish has no OIDC support, so publish with npm while keeping bun for install/build/test. Adds id-token: write permission and --provenance.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #197 +/- ##
=======================================
Coverage 81.29% 81.29%
=======================================
Files 78 78
Lines 2790 2790
Branches 223 223
=======================================
Hits 2268 2268
Misses 476 476
Partials 46 46 🚀 New features to boost your workflow:
|
Slim the pre-publish gate to bun run test, and add workflow_dispatch so 2.9.0 can be published manually without recreating the release.
This branch was successfully deployed
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
The v2.9.0 release failed to publish: the legacy
NPM_TOKEN(from 2022) is no longer permitted to publish under npm's 2FA-bypass token restrictions. This switches the CD workflow to OIDC trusted publishing — no stored token.permissions: id-token: write(required for OIDC)npm publish --provenance --access public(bun has no OIDC support yet); bun still handles install/build/testactions/setup-node+npm install -g npm@latestto guarantee npm ≥ 11.5.1 (OIDC support) and provenance~/.npmrc+NPM_TOKENstep entirelyRequired setup before this can publish
On npmjs.com →
@tarikjabiri/dxf→ Settings → Trusted Publisher, add a GitHub Actions trusted publisher:dxfjs/writer.github/workflows/cd.ymlOnce configured, no
NPM_TOKENsecret is needed and the token can be revoked.Re-publishing 2.9.0
After this merges and the trusted publisher is set up, re-run the failed CD job (or re-create the v2.9.0 release) to publish 2.9.0.