Skip to content

Commit 60268d4

Browse files
committed
build(github): Added CI workflows
1 parent 85a1799 commit 60268d4

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed

.github/workflows/build.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build (CI)
2+
3+
on:
4+
pull_request:
5+
branches: [ master ]
6+
types: [ opened, synchronize, closed ]
7+
push:
8+
branches: [ master ]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
node-version: [ 12.x, 14.x, 16.x ]
17+
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Determine Yarn Cache Path
23+
id: yarn-cache-dir-path
24+
run: echo "::set-output name=dir::$(yarn cache dir)"
25+
26+
- uses: actions/cache@v1
27+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
28+
with:
29+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
30+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.os }}-yarn-
33+
34+
- name: Use Node.js ${{ matrix.node-version }}
35+
uses: actions/setup-node@v1
36+
with:
37+
node-version: ${{ matrix.node-version }}
38+
39+
- name: Install Packages
40+
run: yarn install --frozen-lockfile
41+
42+
- name: Build
43+
run: yarn build
44+
env:
45+
CI: true
46+
47+
- name: Test
48+
run: yarn run test
49+
env:
50+
CI: true

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags:
6+
- v*.*.*
7+
8+
jobs:
9+
publish:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Setup Node.js 12.x to publish to npmjs.org
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: '12.x'
20+
registry-url: 'https://registry.npmjs.org'
21+
22+
- name: Install Packages
23+
run: yarn install --frozen-lockfile
24+
25+
- name: Build
26+
run: yarn build
27+
env:
28+
CI: true
29+
30+
- name: Test
31+
run: yarn run test
32+
env:
33+
CI: true
34+
35+
- name: Generate Release Body
36+
run: npx extract-changelog-release > RELEASE_BODY.md
37+
38+
- name: Publish to NPM
39+
run: yarn publish --non-interactive
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
43+
- name: Create GitHub Release
44+
uses: ncipollo/release-action@v1
45+
with:
46+
bodyFile: "RELEASE_BODY.md"
47+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)