Skip to content

Commit 44d786e

Browse files
authored
ci: add npm publish workflow (#8)
Publishes to npm when a GitHub release is created. Requires NPM_TOKEN secret to be configured.
1 parent 9d8f62d commit 44d786e

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to npm
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: '20'
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Run tests
28+
run: npm test
29+
30+
- name: Publish to npm
31+
run: npm publish --access public --provenance
32+
env:
33+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)