Repository navigation
Publish to npm with trusted publishing instead of NPM_TOKEN - #20
Merged
Merged
Conversation
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 tag-triggered publish failed at
npm whoamiwithE401 Unauthorized(run for tagv1.2.5), because theNPM_TOKENsecret is rejected. Switch the publish job to npm trusted publishing (OIDC) so no long-lived token is needed.permissions: id-token: write(andcontents: read) to thepublishjob.NODE_AUTH_TOKEN/NPM_TOKENusage, thealways-auth/scopesettings, and thenpm whoamipre-check (it cannot work with OIDC; the identity is only exchanged at publish time).Required setup on npmjs.com before re-running
In the
@crestapps/bootstrap-selectpackage settings, add a Trusted Publisher:CrestAppsbootstrap-selectpublish_npm_release.ymlOnce that is saved and this is merged, re-run the publish for the tag (or push a new tag). The
NPM_TOKENrepository secret can then be deleted.Notes
package.jsonalready has the matchingrepositoryURL.v1.2.5to use this change the tag has to be re-pointed at a commit that includes it (or publish a new tag such asv1.2.6).Manual runs
The workflow can also be started from the Actions tab (Run workflow). Enter the version to publish (e.g.
1.2.6); it is used instead of the tag name, validated asMAJOR.MINOR.PATCH, and published from the branch selected in the dialog. Tag pushes work as before.🤖 Generated with Claude Code