Skip to content

Commit 7ab4525

Browse files
authored
build: add release action (#194)
1 parent 87ae962 commit 7ab4525

File tree

4 files changed

+256
-211
lines changed

4 files changed

+256
-211
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
on:
2+
workflow_dispatch:
3+
4+
jobs:
5+
release:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
- name: Verify head of master hasn't changed
10+
run: |
11+
# We ensure that the latest commit on master is still the one we expected when
12+
# we started the release job, otherwise we exit
13+
if [ "$GITHUB_SHA" != "$(git rev-parse --verify HEAD)" ]; then
14+
echo "ERROR: The commit SHA at the HEAD of master has changed"
15+
echo "Expected: $GITHUB_SHA"
16+
echo "Actual: $(git rev-parse --verify HEAD)"
17+
exit 1;
18+
fi
19+
20+
- name: Get yarn cache directory path
21+
id: yarn-cache-dir-path
22+
run: echo "::set-output name=dir::$(yarn cache dir)"
23+
24+
- uses: actions/cache@v2
25+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
26+
with:
27+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-yarn-
31+
32+
- name: Install
33+
run: yarn --ignore-engines --frozen-lockfile
34+
35+
- name: Build
36+
run: yarn build
37+
38+
- name: Release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
42+
run: npx semantic-release

.github/workflows/nodejs.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,53 @@ name: Node CI
33
on: [push]
44

55
jobs:
6-
build:
6+
test:
77
runs-on: ubuntu-latest
8-
98
strategy:
109
matrix:
1110
node-version: [10.x, 12.x, 14.x]
1211

1312
steps:
1413
- uses: actions/checkout@v2
14+
1515
- name: Use Node.js ${{ matrix.node-version }}
1616
uses: actions/setup-node@v1
1717
with:
1818
node-version: ${{ matrix.node-version }}
19+
20+
- name: Get yarn cache directory path
21+
id: yarn-cache-dir-path
22+
run: echo "::set-output name=dir::$(yarn cache dir)"
23+
24+
- uses: actions/cache@v2
25+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
26+
with:
27+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
28+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
29+
restore-keys: |
30+
${{ runner.os }}-yarn-
31+
1932
- name: Install
2033
run: yarn --ignore-engines --frozen-lockfile
34+
2135
- run: git diff --quiet --exit-code
2236
- name: Lint
2337
run: yarn lint
38+
2439
- name: Check format
2540
run: yarn format-check
41+
2642
- name: Build
2743
run: yarn build
44+
2845
- name: Test
2946
run: yarn test
3047
env:
3148
CI: true
49+
3250
- name: Codecov
3351
uses: codecov/codecov-action@v1.0.15
3452
with:
3553
file: ./coverage/lcov.info
3654
flags: unittests
55+

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,5 @@
4848
"prettier": "^2.2.1",
4949
"ts-jest": "^26.4.4",
5050
"typescript": "^4.1.3"
51-
},
52-
"dependencies": {}
51+
}
5352
}

0 commit comments

Comments
 (0)