Skip to content

Commit 169fe47

Browse files
committed
ci(workflows): add github action for release
1 parent aad895f commit 169fe47

File tree

4 files changed

+6864
-1262
lines changed

4 files changed

+6864
-1262
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Setup Node.js
15+
uses: actions/setup-node@v1
16+
with:
17+
node-version: '10.x'
18+
19+
- uses: actions/cache@v2
20+
id: npm-cache
21+
with:
22+
path: node_modules
23+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
24+
restore-keys: |
25+
${{ runner.os }}-npm-
26+
27+
- name: Install dependencies
28+
if: steps.npm-cache.outputs.cache-hit != 'true'
29+
run: npm install
30+
31+
- name: Run tests
32+
run: npm run test
33+
34+
publish:
35+
runs-on: ubuntu-latest
36+
needs: ['test']
37+
steps:
38+
- uses: actions/checkout@v2
39+
40+
- uses: actions/setup-node@v1
41+
with:
42+
node-version: '10.x'
43+
44+
- uses: actions/cache@v2
45+
id: npm-cache
46+
with:
47+
path: node_modules
48+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
49+
restore-keys: |
50+
${{ runner.os }}-npm-
51+
52+
- name: Install dependencies
53+
if: steps.npm-cache.outputs.cache-hit != 'true'
54+
run: npm install
55+
56+
- name: Release and Publish to NPM
57+
run: npx semantic-release
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)