ci: split release into nightly + tag-driven (rc/latest), drop NPM_TOKEN#17
Merged
Conversation
Three release channels, one workflow, one source of truth: master push → nightly: <base>-nightly.<YYYYMMDD>.<sha7>, dist-tag=nightly v<X>-rc.<N> tag → rc: <X>-rc.<N>, dist-tag=rc, GH prerelease v<X> tag → stable: <X>, dist-tag=latest, GH stable Tag derivation is generic — any prerelease identifier (`v0.2.0-beta.0` → dist-tag=beta) works, so we don't need to special-case rc. Nightly publishes mutate package.json + plugin.json ephemerally to stamp the nightly version, then run check:versions so the two manifests stay in lockstep. Concurrency group serializes master pushes so two close-together commits don't race the publish. OIDC + npm Trusted Publishing replaces NPM_TOKEN — `id-token: write` is the only credential. Drop the token env from both jobs; the NPM_TOKEN secret can be revoked from the repo settings after the first successful OIDC publish. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Summary
Three release channels in one workflow:
master<pkg.version>-nightly.<YYYYMMDD>.<sha7>nightlyv<X>-rc.<N><X>-rc.<N>rcv<X>-<id>.<N><X>-<id>.<N><id>v<X><X>latestTag-derivation is generic: any semver prerelease identifier becomes the dist-tag (
v0.2.0-beta.0→beta), so no special-casing per channel.Notable
package.json+.claude-plugin/plugin.jsonin-place (never committed), then runspnpm run check:versionsto confirm parity beforepnpm run buildandnpm publish. The base version comes straight frompackage.jsonon master, so master always advertises the next-target version.nightly-publishwithcancel-in-progress: falseserializes master pushes — two close commits don't race the publish step. We want every commit's nightly to ship.NPM_TOKENis gone from both jobs.id-token: writeis the only credential; npm verifies the workflow's identity. After the first successful OIDC publish from this branch, theNPM_TOKENsecret can be revoked in repo settings.--provenance) — works hand-in-hand with OIDC and produces signed attestations for every nightly + rc + latest.scripts/bundle.jsderives its runtime version stamp from git (tag→ tag, otherwise →dev-<sha>), independent ofpackage.json. Nightly bins will reportdev-<sha>at runtime even though npm version is<base>-nightly.<date>.<sha>. Both encode the sha, so reproducibility is intact. We can teachbundle.jsto prefer a mutatedpackage.jsonversion in a follow-up if the inconsistency bites.Test plan
Cannot fully verify without merging — Trusted Publishing OIDC + tag-triggered jobs only run from
master. Plan once merged:npm view cli-bridge versionslists0.1.2-nightly.<date>.<sha>andnpm view cli-bridge dist-tagsshowsnightly: 0.1.2-nightly.<date>.<sha>.lateststays at0.1.2.::notice::line to confirm derived version + dist-tag.v0.1.3to confirm latest path. (Or pushv0.1.3-rc.0first to prove the rc path; up to you.)NPM_TOKENsecret after first OIDC publish succeeds.Existing local validation:
v0.1.3,v0.1.3-rc.0,v0.1.3-dev.5,v0.2.0-beta.🤖 Generated with Claude Code