Skip to content

Commit 082b625

Browse files
authored
Enable NPM trusted publishing with OIDC (#15)
## Summary Update npm publish workflow to use OIDC trusted publishing with provenance. ## Changes - Add `id-token: write` and `contents: read` permissions for OIDC authentication - Update to `npx npm@11.7.0 publish` with `--provenance` flag for supply chain security - Update actions to v6 - Remove `NODE_AUTH_TOKEN` secret (no longer needed with OIDC) ## Status ✅ Trusted publishing has been configured on npmjs.com for this package.
1 parent 770da62 commit 082b625

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,15 @@ jobs:
1414
runs-on: ubuntu-latest
1515

1616
permissions:
17+
contents: read
1718
# https://docs.npmjs.com/generating-provenance-statements#publishing-packages-with-provenance-via-github-actions
1819
id-token: write
1920

2021
steps:
21-
- uses: actions/checkout@v4
22+
- uses: actions/checkout@v6
2223

23-
- uses: actions/setup-node@v4.4.0
24+
- uses: actions/setup-node@v6
2425
with:
25-
# Needed for NODE_AUTH_TOKEN env var to work for npm publish
26-
# https://github.com/actions/setup-node#:~:text=NODE_AUTH_TOKEN.%0A%20%20%20%20%23%20Default%3A%20%27%27-,registry,-%2Durl%3A%20%27
2726
registry-url: https://registry.npmjs.org
2827

2928
- run: npm install
@@ -32,6 +31,4 @@ jobs:
3231

3332
- name: Publish to NPM
3433
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
35-
run: npm publish --provenance --access public
36-
env:
37-
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
34+
run: npx npm@11.7.0 publish --provenance --access public

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@ node_modules
55
dist
66
.*_cache*
77
package-lock.json
8+
.DS_Store

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
],
2828
"repository": {
2929
"type": "git",
30-
"url": "https://github.com/foxglove/comlink.git"
30+
"url": "git+https://github.com/foxglove/comlink.git"
3131
},
3232
"license": "Apache-2.0",
3333
"devDependencies": {

0 commit comments

Comments
 (0)