Publish from CI on a version tag - #7
Merged
Merged
Conversation
Releases depended on whoever had a working npm login locally, which is also how 0.3.0 ended up tagged but never published. Pushing a version tag now runs lint, format, tests and build, checks the tag against package.json, and publishes with provenance. publishConfig.access=public is set so a plain 'npm publish' cannot fall back to a restricted publish -- scoped packages default to restricted.
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.
Why
Releasing depended on whoever happened to hold a working
npm login. That is how 0.3.0 ended up tagged in git but never published to npm — the registry still serves0.1.0aslatest, with0.2.0missing too.What
.github/workflows/publish.yml— pushing a bare version tag (0.3.1, matching this repo's existing tag style) runslint,format:check,testandbuild, then publishes.package.json's version. This is precisely the 0.3.0 failure mode: tag said 0.3.0,package.jsonsaid 0.2.0.id-token: write+--provenanceattaches an attestation linking the tarball to this commit and workflow.publishConfig.access: "public"inpackage.json, so a publish can never silently fall back to a restricted one — scoped packages default torestricted.Setup needed before the first run
Add a repository secret
NPM_TOKEN— an npm Automation token (Access Tokens → Generate New Token → Automation) for an account with publish rights on the@stromcomscope. Granular tokens work too; a "Read-only" token does not.If you would rather not store a token at all, npm Trusted Publishing (OIDC) is the alternative: configure this repo and workflow as a trusted publisher on npmjs.com and drop the
NODE_AUTH_TOKENenv. Happy to switch it over.Releasing from here
Master is already at
0.3.1, so once this lands, pushing the0.3.1tag publishes it.