Skip to content

Commit 54b8dec

Browse files
committed
feat: add npm trusted publishing workflow
1 parent cd2975b commit 54b8dec

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
id-token: write # Required for OIDC trusted publishing
10+
contents: read
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
# Ensure npm 11.5.1 or later is installed for trusted publishing
25+
- name: Update npm
26+
run: npm install -g npm@latest
27+
28+
- run: npm ci
29+
30+
- name: Build
31+
run: npm run build
32+
33+
- name: Run tests
34+
run: npm test
35+
continue-on-error: true
36+
37+
- name: Publish to npm
38+
run: npm publish --access public --tag latest
39+

0 commit comments

Comments
 (0)