feat(ci): add workflow to promote an npm dist-tag - #435
Merged
Conversation
Publishing under `next` for soak testing leaves no in-repo way to flip `latest` afterwards -- the NPM_TOKEN lives only in the repo secret, so the promotion had to be done from a machine with local npm credentials. Add a workflow_dispatch job that runs `npm dist-tag add` against the registry using the existing NPM_TOKEN. It verifies the version is actually published first and prints the dist-tags before and after. This doubles as the release rollback lever: re-pointing `latest` at the previous version still works long after the 72-hour unpublish window closes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.
Problem
Publishing under
nextfor soak testing leaves no in-repo way to fliplatestafterwards. TheNPM_TOKENlives only in the repo secret (write-only, can't be read back), so promoting a release meant runningnpm dist-tag addfrom a machine with local npm credentials — which errors with401 Unauthorizedif you don't happen to have any.Change
Adds
.github/workflows/promote-tag.yml, aworkflow_dispatchjob taking two inputs:version— the already-published version (e.g.5.3.0)tag— the dist-tag to point at it (defaults tolatest)It runs
npm dist-tag addagainst the registry using the existingNPM_TOKENsecret. Noactions/checkout—dist-tagonly talks to the registry, never the working tree.Steps:
registry-url(matchesnpm-publish.yml)dist-tag addnpm dist-tag add, guarding against an unset secretWhy it's worth having beyond the immediate 401
This is also the release rollback lever. Unpublishing is only possible within 72 hours, but re-pointing
latestat the previous version works indefinitely — so if a release turns out bad a week later, this is the fix.Note for whoever runs it first
If the
NPM_TOKENsecret is a granular token, check it has write permission onmsnodesqlv8and hasn't expired — granular tokens default to a 30-day life. A classic Automation token has no expiry and bypasses 2FA. A 401 at the promote step means the token, not the command.🤖 Generated with Claude Code