Skip to content

Commit 578a4f8

Browse files
committed
ci: add publish script
1 parent 2276b71 commit 578a4f8

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,4 @@ jobs:
3737
- name: Build
3838
run: |
3939
npm ci
40-
npm run build
41-
40+
npm run build

.github/workflows/publish.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- *
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
- name: SetupNode
15+
uses: actions/setup-node@v2
16+
with:
17+
node-version: 14
18+
- name: Test
19+
run: |
20+
npm install
21+
npm run test
22+
23+
publish:
24+
needs: test
25+
runs-on: ubuntu-latest
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
- name: SetupNode
30+
uses: actions/setup-node@v2
31+
with:
32+
node-version: 14
33+
- name: Build
34+
run: |
35+
npm ci --ignore-scripts
36+
npm run build
37+
- name: Publish
38+
run: |
39+
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
40+
npm publish --ignore-scripts
41+
env:
42+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)