ci: sync the release workflow on v2/main with main's verbatim - #1904
Conversation
main's copy of .github/workflows/main.yml carried three release fixes v2/main never took -- #1831 (least-privilege default GITHUB_TOKEN scope), #1834 (derive the npm dist-tag from the version) and #1836 (publish via npm OIDC trusted publishing). Diffing the file both directions shows v2/main has NOTHING main lacks: its only unique content is the superseded publish step, run: npm publish --access public --provenance env: NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} which is exactly what #1836 replaced. Every other line already matched. So this is a verbatim copy of main's file rather than a hunk-by-hunk forward-port -- fewer ways to get it wrong, and it leaves the two branches byte-identical (`git diff origin/main -- .github/workflows` is now empty). Not a back-merge: only this one file is taken, so none of main's pre-swap v1 lineage enters v2/main's ancestry (see #1868). Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01YAt8rqxysNbhYWLhoRm3fU
There was a problem hiding this comment.
Pull request overview
This PR updates v2/main’s release workflow (.github/workflows/main.yml) to match the main branch’s current publishing behavior, removing the stale NPM_TOKEN-based publish path and aligning v2/main with the OIDC trusted publishing + dist-tag safeguards already used on releases cut from main.
Changes:
- Adds a workflow-level least-privilege default
GITHUB_TOKENpermission (contents: read), with publish jobs explicitly overriding as needed. - Ensures the publish job upgrades npm to a version that supports OIDC trusted publishing (
npm >= 11.5.1). - Switches npm publishing to explicitly derive and pass the dist-tag (
nextfor prereleases,latestotherwise) and removes theNODE_AUTH_TOKENsecret usage.
|
Copilot review round 1 on `10ec5bdc`: no comments — no inline findings, no suppressed nits, and the overview reads the change correctly (least-privilege default token, npm ≥ 11.5.1 for OIDC, dist-tag derivation, removal of the Nothing to respond to, so no changes pushed — the branch is still byte-identical to |
Closes #1902
Surfaced while building the v2.1.0 milestone-merge resolution branch (#1903): after resolving all eight conflicts,
.github/workflows/main.ymlwas the only file where the merged tree still differed fromv2/main.The question this answers
Rather than forward-port the three commits hunk by hunk, I diffed the file both directions first.
v2/mainhas nothingmainlacks — its only unique content is the superseded publish step:which is precisely what #1836 replaced. Every other line already matched. So this is a verbatim copy of
main's file — fewer ways to get it wrong than reconstructing hunks, and it leaves the two branches byte-identical.What v2/main gains
permissions: contents: readforGITHUB_TOKEN-rccan't publish tolatestid-token: write+environment: release)That last one matters most:
v2/main's copy authenticated withNODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}against a secret this repo does not have, which writes an empty_authTokeninto the generated.npmrcand failsENEEDAUTHbefore OIDC is ever attempted.Nothing was actually broken — releases are cut from
main, which has the good copy — butv2/main's is the one every future PR edits, so the divergence was a live trap.Not a back-merge
Only this one file is taken from
main. None of main's pre-swap v1 lineage entersv2/main's ancestry, so the #1868 reasoning is respected.Verification
git diff origin/main -- .github/workflows/main.ymlon this branch is empty — the two are now byte-identical.yaml.safe_load).validate/coverage/smoke/ Storybook do not read or execute. The content's real proof is that it is the exact filemainhas been publishing 2.0.0 with.🤖 Generated with Claude Code
https://claude.ai/code/session_01YAt8rqxysNbhYWLhoRm3fU