Skip to content

Commit 36d3bd2

Browse files
Merge pull request #2 from phillip-kruger/main
Added GH Action
2 parents ac7c13d + 663e888 commit 36d3bd2

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish to npm on Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
publish:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout code
12+
uses: actions/checkout@v2
13+
14+
- name: Set up Node.js
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: '16'
18+
registry-url: 'https://registry.npmjs.org/'
19+
20+
- name: Install dependencies
21+
run: npm install
22+
23+
- name: Update version in package.json
24+
run: |
25+
RELEASE_VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//')
26+
npm version $RELEASE_VERSION --no-git-tag-version
27+
28+
- name: Publish to npm
29+
run: npm publish
30+
env:
31+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)