Skip to content

Commit c6afd1c

Browse files
committed
ci: use oidc for npm publish
1 parent 7410a7c commit c6afd1c

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

.github/workflows/main.yml

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,36 @@ name: Node.js Package
22

33
on:
44
push:
5-
branches:
6-
- main
5+
branches: [main]
6+
tags:
7+
- "v*"
8+
pull_request:
9+
branches: [main]
710

811
jobs:
912
build:
1013
runs-on: ubuntu-latest
1114
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-node@v4
15+
- uses: actions/checkout@v5
16+
- uses: actions/setup-node@v6
1417
with:
15-
node-version: 20
18+
node-version: 24
1619
- run: npm ci
1720

1821
publish-npm:
1922
needs: build
23+
if: startsWith(github.ref, 'refs/tags/v')
2024
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
id-token: write
2128
steps:
22-
- uses: actions/checkout@v4
23-
- uses: actions/setup-node@v4
29+
- uses: actions/checkout@v5
30+
- uses: actions/setup-node@v6
2431
with:
25-
node-version: 20
32+
node-version: 24
2633
registry-url: https://registry.npmjs.org/
2734
- run: npm ci
28-
- run: npm publish
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
- run: node -v
36+
- run: npm -v
37+
- run: npm publish --provenance

0 commit comments

Comments
 (0)