Skip to content

Commit 6feb6c2

Browse files
mogerycapy-ai[bot]
andauthored
ci(release): publish to npm with trusted publishing (#232)
Drop NODE_AUTH_TOKEN from the npm publish and dry-run steps. Both jobs already run GitHub-hosted with id-token: write, so npm authenticates through OIDC once each package has a trusted publisher. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
1 parent 0a6a4fd commit 6feb6c2

1 file changed

Lines changed: 8 additions & 14 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# PyPI trusted publishing is registered against this exact filename (release.yml);
2-
# renaming the file breaks the PyPI publisher.
1+
# PyPI and npm trusted publishing are registered against this exact filename
2+
# (release.yml); renaming the file breaks both publishers.
33
name: Release
44

55
on:
@@ -161,12 +161,12 @@ jobs:
161161
publish-npm:
162162
name: Publish npm
163163
needs: [gate, test-node]
164-
# npm rejects provenance attestations minted on self-hosted runners
165-
# (Blacksmith counts as self-hosted), so publishing runs GitHub-hosted.
164+
# npm accepts trusted publishing and provenance only from GitHub-hosted
165+
# runners (Blacksmith counts as self-hosted), so publishing runs GitHub-hosted.
166166
runs-on: ubuntu-latest
167167
permissions:
168168
contents: read
169-
id-token: write # npm provenance
169+
id-token: write # npm trusted publishing and provenance
170170
steps:
171171
- uses: actions/checkout@v7
172172
- uses: actions/setup-node@v7
@@ -198,7 +198,6 @@ jobs:
198198
run: npm publish --access public
199199
working-directory: node
200200
env:
201-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
202201
NPM_CONFIG_PROVENANCE: true
203202
- name: Publish (dry run)
204203
# Skipped when the version is live: npm refuses even a --dry-run
@@ -208,18 +207,16 @@ jobs:
208207
# would otherwise publish the per-platform packages and cut a GitHub release.
209208
run: npm publish --dry-run --ignore-scripts --access public
210209
working-directory: node
211-
env:
212-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
213210

214211
publish-npm-wasm:
215212
name: Publish npm (wasm)
216213
needs: [gate, test-rust]
217-
# npm rejects provenance attestations minted on self-hosted runners
218-
# (Blacksmith counts as self-hosted), so build and publish run GitHub-hosted.
214+
# npm accepts trusted publishing and provenance only from GitHub-hosted
215+
# runners (Blacksmith counts as self-hosted), so build and publish run GitHub-hosted.
219216
runs-on: ubuntu-latest
220217
permissions:
221218
contents: read
222-
id-token: write # npm provenance
219+
id-token: write # npm trusted publishing and provenance
223220
steps:
224221
- uses: actions/checkout@v7
225222
- uses: dtolnay/rust-toolchain@stable
@@ -255,14 +252,11 @@ jobs:
255252
run: npm publish --access public
256253
working-directory: wasm/pkg
257254
env:
258-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
259255
NPM_CONFIG_PROVENANCE: true
260256
- name: Publish (dry run)
261257
if: github.event_name == 'workflow_dispatch' && steps.probe.outputs.published == 'false'
262258
run: npm publish --dry-run --access public
263259
working-directory: wasm/pkg
264-
env:
265-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
266260

267261
publish-crates:
268262
name: Publish crates.io

0 commit comments

Comments
 (0)