Skip to content

Commit d44f05a

Browse files
committed
Add auto publish script
1 parent 3f8b9e2 commit d44f05a

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/publish.yml

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Publish
2+
on:
3+
push:
4+
branches:
5+
- master
6+
7+
jobs:
8+
publish_to_npm:
9+
name: Publish to NPM
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v2
14+
- name: Check if version bump
15+
id: check
16+
uses: EndBug/[email protected]
17+
18+
- name: Log when unchanged
19+
if: steps.check.outputs.changed != 'true'
20+
run: echo "No version change"
21+
22+
- name: Install yarn
23+
if: steps.check.outputs.changed == 'true'
24+
run: npm -g i yarn
25+
26+
- name: Install deps
27+
if: steps.check.outputs.changed == 'true'
28+
run: yarn
29+
env:
30+
CI: true
31+
32+
- name: Build
33+
if: steps.check.outputs.changed == 'true'
34+
run: yarn build
35+
env:
36+
CI: true
37+
38+
- name: Set NPM Token
39+
if: steps.check.outputs.changed == 'true'
40+
uses: filipstefansson/set-npm-token-action@v1
41+
with:
42+
token: ${{ secrets.NPM_TOKEN }}
43+
44+
- name: Publish new version
45+
if: steps.check.outputs.changed == 'true'
46+
run: npm publish
47+
env:
48+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)