File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55 tags :
66 - " v*"
77
8+ permissions :
9+ contents : read
10+ id-token : write # OIDC for npm trusted publishing
11+
812jobs :
913 publish :
1014 runs-on : ubuntu-latest
11- permissions :
12- contents : read
13- id-token : write
14-
1515 steps :
1616 - uses : actions/checkout@v4
17-
1817 - uses : actions/setup-node@v4
1918 with :
2019 node-version : " 20"
2120 registry-url : " https://registry.npmjs.org"
2221 cache : " npm"
23-
22+ # Trusted publishing needs npm >= 11.5.1, newer than the bundled version.
23+ - run : npm install -g npm@latest
2424 - run : npm ci
25-
2625 - run : npm run build
27-
2826 - name : Check tag matches package version
2927 run : |
3028 TAG_VERSION=${GITHUB_REF#refs/tags/v}
3331 echo "Version mismatch: tag v$TAG_VERSION, package.json v$PKG_VERSION" >&2
3432 exit 1
3533 fi
36-
37- # OIDC trusted publishing: no stored token. Requires npm >= 11.5.1 and a
38- # trusted publisher configured on npmjs for @nbtca/prompt (publish.yml).
39- # --provenance engages the OIDC id-token for both auth and provenance.
40- - name : Publish
41- run : |
42- npm install -g npm@latest
43- # setup-node writes a dummy _authToken into this .npmrc; remove it so
44- # npm uses the OIDC-exchanged credential (not the fake token) for the
45- # registry write. --provenance forces npm to engage OIDC.
46- sed -i '/_authToken/d' "$NPM_CONFIG_USERCONFIG"
47- npm publish --access public --provenance
34+ # Auth via OIDC trusted publishing — no NPM_TOKEN, no stored secret.
35+ - run : npm publish --access public
You can’t perform that action at this time.
0 commit comments