Skip to content

ci: OIDC cannot do the first publish — keep a token for it - #15

Closed
catomean wants to merge 1 commit into
mainfrom
ci/first-publish-needs-token
Closed

ci: OIDC cannot do the first publish — keep a token for it#15
catomean wants to merge 1 commit into
mainfrom
ci/first-publish-needs-token

Conversation

@catomean

Copy link
Copy Markdown
Collaborator

#13 removed NODE_AUTH_TOKEN in favour of OIDC trusted publishing. That is the right destination, but it cannot get us there: trusted publishing is configured per package on npmjs.com, and a package that has never been published cannot have a trusted publisher configured.

Observed on tag v0.1.1 (run 31953553423):

npm notice publish Signed provenance statement with source and build information from GitHub Actions
npm notice publish Provenance statement published to transparency log
npm error code E404
npm error 404 Not Found - PUT https://registry.npmjs.org/ai-forms
npm error 404  The requested resource 'ai-forms@0.1.1' could not be found or you do not have permission to access it.

Provenance signing succeeded — that part of OIDC works. The publish itself was unauthenticated, and npm answers 404 rather than 401 for an unauthenticated publish of a non-existent package, which reads like a missing package instead of a missing credential.

This restores NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} on the publish step, keeping id-token: write and everything else from #13. npm prefers OIDC whenever the package has a trusted publisher, so after the first release this secret is unused and can be deleted.

🤖 Generated with Claude Code

Trusted publishing is configured per package on npmjs.com, and a package
that has never been published cannot have a trusted publisher configured.
The token-free workflow therefore fails on the very first release.

Observed on tag v0.1.1: provenance was signed and logged to sigstore,
then the PUT returned E404 'could not be found or you do not have
permission' — npm answers 404 rather than 401 for an unauthenticated
publish of a package that does not exist yet, which reads as a missing
package rather than a missing credential.

NPM_TOKEN is used only until ai-forms exists and a trusted publisher is
configured; npm prefers OIDC after that.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@catomean

Copy link
Copy Markdown
Collaborator Author

Superseded by #14, which landed the same fix (token for the first publish, OIDC afterwards) while this was open. Closing as duplicate — no disagreement, just two sessions reaching it at once.

@catomean catomean closed this Aug 16, 2026
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