Skip to content

Commit 70da656

Browse files
Omar Bniclaude
andcommitted
ci: switch CLI release to npm OIDC trusted publishing
- id-token: write + npm >= 11.5.1, drop the NPM_TOKEN secret - document the first-publish-must-be-manual npm limitation Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018pJJgDHCnnNeEqEAApxFcQ
1 parent 005118b commit 70da656

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

.github/workflows/release-cli.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
# Publishes create-clanker-support to npm. Trigger by pushing a tag:
22
# create-clanker-support@1.0.0
3-
# Requires an NPM_TOKEN secret (npm automation token with publish rights to the
4-
# unscoped `create-clanker-support` name). The tag version must match
5-
# packages/create-clanker-support/package.json — asserted before publish.
3+
# Auth is OIDC trusted publishing (no token secret): configure a trusted
4+
# publisher on the npm package (Settings -> Trusted publisher) pointing at
5+
# org: theopenco repo: clankersupport-templates
6+
# workflow: release-cli.yml environment: (none)
7+
# npm can only add a trusted publisher to an EXISTING package, so the very
8+
# first publish must be done manually (`npm publish --access public` from
9+
# packages/create-clanker-support) — every release after that is OIDC.
10+
# The tag version must match packages/create-clanker-support/package.json —
11+
# asserted before publish.
612
name: Release CLI
713

814
on:
@@ -13,6 +19,9 @@ on:
1319
jobs:
1420
publish:
1521
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
id-token: write # OIDC token for npm trusted publishing
1625
defaults:
1726
run:
1827
working-directory: packages/create-clanker-support
@@ -22,6 +31,8 @@ jobs:
2231
with:
2332
node-version: 22
2433
registry-url: https://registry.npmjs.org
34+
# Node 22 bundles npm 10; trusted publishing needs npm >= 11.5.1.
35+
- run: npm install -g npm@11
2536
- name: Assert tag matches package version
2637
run: |
2738
TAG_VERSION="${GITHUB_REF_NAME#create-clanker-support@}"
@@ -32,5 +43,3 @@ jobs:
3243
run: node index.mjs --help | grep -q "create-clanker-support"
3344
- name: Publish
3445
run: npm publish --access public
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)