Skip to content

Commit c64ea93

Browse files
committed
feat: add npm publishing to release workflow
Automatically publish @invoicetronic/sdk to npm when GitHub releases are created.
1 parent aa46677 commit c64ea93

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/release.yml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Create Release
1+
name: Create Release and Publish to NPM
22

33
on:
44
push:
@@ -22,3 +22,32 @@ jobs:
2222
make_latest: true
2323
env:
2424
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
26+
npm-publish:
27+
needs: github-release
28+
runs-on: ubuntu-latest
29+
steps:
30+
- name: Checkout
31+
uses: actions/checkout@v4
32+
33+
- name: Setup Node.js
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '18'
37+
registry-url: 'https://registry.npmjs.org'
38+
39+
- name: Install dependencies
40+
run: npm ci
41+
42+
- name: Build package
43+
run: npm run build
44+
45+
- name: Update package version
46+
run: |
47+
TAG_VERSION=${GITHUB_REF#refs/tags/v}
48+
npm version $TAG_VERSION --no-git-tag-version
49+
50+
- name: Publish to NPM
51+
run: npm publish --access public
52+
env:
53+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)