Skip to content

Commit b6c41ea

Browse files
authored
Add GitHub Actions workflow for npm publishing
1 parent 43cc56d commit b6c41ea

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish to npm
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write # needed to create the GitHub release
10+
id-token: write # needed for npm trusted publishing (OIDC)
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
# If you set an "Environment name" on the npm trusted publisher page,
16+
# uncomment the line below and use the same name. This lets you add a
17+
# required-reviewer gate in repo Settings > Environments if you want
18+
# one last manual "approve" click before publish actually runs.
19+
# environment: npm-publish
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 24
29+
registry-url: 'https://registry.npmjs.org'
30+
cache: 'npm'
31+
32+
- name: Install dependencies
33+
run: npm ci
34+
35+
- name: Type check
36+
run: npm run typecheck --if-present
37+
38+
- name: Run tests
39+
run: npm test --if-present
40+
41+
- name: Build
42+
run: npm run build --if-present
43+
44+
- name: Publish to npm
45+
run: npm publish
46+
47+
- name: Create GitHub Release
48+
uses: softprops/action-gh-release@v2
49+
with:
50+
generate_release_notes: true

0 commit comments

Comments
 (0)