Skip to content

Commit eae89c4

Browse files
committed
feat: add GitHub Actions workflow for npm release
1 parent c3c8e66 commit eae89c4

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

.github/workflows/release.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Publish npm Release
2+
3+
on:
4+
workflow_dispatch: # Manual trigger for testing
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
permissions:
9+
contents: write
10+
id-token: write
11+
packages: read
12+
13+
jobs:
14+
release:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: '20.19.0'
25+
registry-url: 'https://registry.npmjs.org'
26+
cache: 'npm'
27+
always-auth: true
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Run tests
33+
run: npm all
34+
35+
- name: Publish to npm
36+
run: |
37+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
38+
echo "🧪 Test mode: Dry run npm publish"
39+
npm publish --dry-run --provenance
40+
else
41+
echo "🚀 Production: Publishing to npm"
42+
npm publish --provenance
43+
fi
44+
env:
45+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
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)