Skip to content

Commit 455a0b3

Browse files
committed
ci: add GitHub Actions workflow for Node.js package publishing
1 parent e0e5e53 commit 455a0b3

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Node.js Package
2+
on:
3+
push:
4+
tags:
5+
- v[0-9]+.[0-9]+.[0-9]+
6+
7+
permissions:
8+
contents: write
9+
packages: write
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v5
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/setup-node@v6
20+
with:
21+
node-version: "22.x"
22+
cache: "npm"
23+
registry-url: "https://registry.npmjs.org"
24+
25+
- name: Install dependencies
26+
run: npm ci
27+
28+
- name: Build
29+
run: npm run build
30+
31+
- name: Run tests
32+
run: npm test
33+
34+
- name: Publish to NPM
35+
run: npm publish --access public
36+
env:
37+
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
38+
39+
- name: Create GitHub Release
40+
uses: softprops/action-gh-release@v2
41+
with:
42+
tag_name: ${{ github.ref_name }}
43+
name: Release ${{ github.ref_name }}
44+
generate_release_notes: true
45+
draft: false
46+
prerelease: false
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)