Skip to content

Commit 4b02ff3

Browse files
authored
Merge pull request #146 from sankhesh/npm_publish
Npm publish: switch to OIDC publish workflow
2 parents a6252e1 + 6c50ff5 commit 4b02ff3

2 files changed

Lines changed: 26 additions & 5 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"

package.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,5 +82,19 @@
8282
},
8383
"files": [
8484
"dist"
85-
]
85+
],
86+
"release": {
87+
"branches": [
88+
"master"
89+
],
90+
"plugins": [
91+
"@semantic-release/commit-analyzer",
92+
"@semantic-release/release-notes-generator",
93+
"@semantic-release/npm",
94+
"@semantic-release/github"
95+
]
96+
},
97+
"publishConfig": {
98+
"access": "public"
99+
}
86100
}

0 commit comments

Comments
 (0)