Skip to content

feat(ci): add workflow to promote an npm dist-tag - #435

Merged
TimelordUK merged 1 commit into
masterfrom
feat/promote-dist-tag
Aug 26, 2026
Merged

feat(ci): add workflow to promote an npm dist-tag#435
TimelordUK merged 1 commit into
masterfrom
feat/promote-dist-tag

Conversation

@TimelordUK

Copy link
Copy Markdown
Owner

Problem

Publishing under next for soak testing leaves no in-repo way to flip latest afterwards. The NPM_TOKEN lives only in the repo secret (write-only, can't be read back), so promoting a release meant running npm dist-tag add from a machine with local npm credentials — which errors with 401 Unauthorized if you don't happen to have any.

Change

Adds .github/workflows/promote-tag.yml, a workflow_dispatch job taking two inputs:

  • version — the already-published version (e.g. 5.3.0)
  • tag — the dist-tag to point at it (defaults to latest)

It runs npm dist-tag add against the registry using the existing NPM_TOKEN secret. No actions/checkoutdist-tag only talks to the registry, never the working tree.

Steps:

  1. Setup Node 24 with registry-url (matches npm-publish.yml)
  2. Verify the version is actually published — fails fast with a clear message rather than a confusing 404 from dist-tag add
  3. Print dist-tags before
  4. npm dist-tag add, guarding against an unset secret
  5. Print dist-tags after
  6. Step summary

Why 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 latest at 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_TOKEN secret is a granular token, check it has write permission on msnodesqlv8 and 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

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>
@TimelordUK
TimelordUK merged commit 02d8a2e into master Aug 26, 2026
10 checks passed
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