Skip to content

Commit 855b200

Browse files
1 parent afb10ca commit 855b200

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1-
name: Publish package to GitHub Packages
1+
name: Publish package to npm (trusted publisher)
22
on:
33
push:
44
branches:
55
- main
6+
permissions:
7+
contents: read
8+
id-token: write # required for npm trusted publisher (OIDC)
69
jobs:
710
build:
8-
runs-on: ubuntu-latest
9-
permissions:
10-
contents: read
11-
packages: write
11+
runs-on: ubuntu-latest
12+
1213
steps:
13-
- uses: actions/checkout@v3
14-
# Setup .npmrc file to publish to GitHub Packages
15-
- uses: actions/setup-node@v3
14+
- uses: actions/checkout@v4
15+
- uses: actions/setup-node@v4
1616
with:
17-
node-version: '18.x'
18-
registry-url: 'https://registry.npmjs.org'
17+
node-version: "18.x"
18+
registry-url: "https://registry.npmjs.org"
1919
- run: npm ci
2020
- run: npm run build
21-
- run: npm publish --access public
22-
env:
23-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21+
# OIDC auth + provenance; no token needed when using trusted publishers
22+
- run: npm publish --provenance --access public

0 commit comments

Comments
 (0)