Skip to content

Commit 6c50ff5

Browse files
committed
ci: switch to OIDC trusted publishing for npm
1 parent a94ab9e commit 6c50ff5

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

.github/workflows/publish.yaml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,25 @@ on:
33
push:
44
branches:
55
- master
6-
- beta
76

87
jobs:
98
publish:
109
name: Publish
1110
runs-on: ubuntu-24.04
11+
permissions:
12+
contents: write # to be able to publish a GitHub release
13+
issues: write # to be able to comment on released issues
14+
pull-requests: write # to be able to comment on released pull requests
15+
id-token: write # to enable use of OIDC for npm provenance
16+
environment:
17+
name: npm
1218
steps:
1319
- name: Checkout
1420
uses: actions/checkout@v2
1521
with:
1622
fetch-depth: 0
1723
- name: Setup node
18-
uses: actions/setup-node@v1
24+
uses: actions/setup-node@v4
1925
with:
2026
node-version: 24
2127
- name: Install dependencies
@@ -26,8 +32,9 @@ jobs:
2632
run: npm run test
2733
- name: Release
2834
env:
29-
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
30-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
# No need to set NPM_TOKEN because of OIDC
37+
NPM_CONFIG_PROVENANCE: true
3138
run: |
3239
git config --global user.name "Github Actions"
3340
git config --global user.email "sebastien.jourdain@kitware.com"

0 commit comments

Comments
 (0)