Repository navigation
fix: publish to npm with npm CLI instead of bun publish - #6
Merged
Merged
Conversation
'bun publish' does not implement npm's OIDC Trusted Publisher token exchange, so the workflow failed with 'missing authentication' even though id-token: write was granted and the npm package's trusted publisher was configured. npm's CLI (>= 11.5.1) performs this OIDC exchange automatically when the registry is configured via actions/setup-node. Add a Setup Node.js step and switch the final publish command to 'npm publish --access public --tag ...'. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
bun publishstep but failed witherror: missing authentication (run \bunx npm login`), even thoughid-token: writewas granted and the npm package has a Trusted Publisher configured for this repository/workflow. Root cause: npm's OIDC Trusted Publisher flow performs a token exchange that is implemented by the **npm CLI** (>= 11.5.1), not bybun publish`. Bun does not yet support this OIDC exchange, so it has no credentials to authenticate with.Changes
.github/workflows/publish.yml: added aSetup Node.jsstep (actions/setup-node@v4,registry-url: https://registry.npmjs.org) to thepublishjob, and switched the final publish command frombun publish --access public --tag "$npm_tag"tonpm publish --access public --tag "$npm_tag". The rest of the job (install, lint, test, build, pack dry-run) continues to use Bun.docs/development/publishing.md: documented thatnpm publish(notbun publish) performs the OIDC exchange.CHANGELOG.md: documented the fix under the0.0.1-rc.2entry.Validation
bun run format:check— passesbun run lint— passesnpm --version(12.0.2, bundled with Node 24) supports Trusted Publisher OIDC exchange (requires >= 11.5.1).Risks
npm publishstep in an environment-gated,workflow_dispatch-only job. No functional/runtime code changes. If the npm Trusted Publisher configuration on npmjs.com is itself misconfigured, this change alone will not fix publishing — it fixes the tool-side integration gap only.Checklist