Skip to content

Commit e37a1db

Browse files
committed
Add workflow to publish releases to NPM
1 parent 7eb3c51 commit e37a1db

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

.github/workflows/ci.yml

+28
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ on:
55
branches: [ master ]
66
pull_request:
77
branches: [ master ]
8+
release:
9+
types: [ created ]
810

911
jobs:
1012
build:
@@ -25,3 +27,29 @@ jobs:
2527

2628
- name: Run test suite
2729
run: yarn run test
30+
31+
publish:
32+
needs: build
33+
runs-on: ubuntu-latest
34+
if: ${{ github.event_name == 'release' }}
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v2
39+
40+
- name: Setup Node
41+
uses: actions/setup-node@v1
42+
with:
43+
node-version: 12
44+
registry-url: https://registry.npmjs.org/
45+
46+
- name: Install dependencies
47+
run: yarn install --frozen-lockfile
48+
49+
- name: Set new version
50+
run: npm version --allow-same-version --no-git-tag-version ${{ github.event.release.tag_name }}
51+
52+
- name: Publish release
53+
run: npm publish
54+
env:
55+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 commit comments

Comments
 (0)