-
-
Notifications
You must be signed in to change notification settings - Fork 147
55 lines (52 loc) · 1.52 KB
/
run-tests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Run tests
on:
push:
branches:
- master
- beta
- alpha
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Use node 12
uses: actions/setup-node@v1
with:
node-version: 12
- name: Install depencencies
run: npm ci
- name: Run tests
run: npm run test
release:
needs: build-and-test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta' || github.ref == 'refs/heads/alpha'
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Use node 12
uses: actions/setup-node@v1
with:
node-version: 12
- uses: svrooij/secret-gate-action@v1 # see https://github.com/svrooij/secret-gate-action this is to fail quiet until secret is set.
id: mygate
with:
inputsToCheck: 'NPM_TOKEN'
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Install depencencies
if: steps.mygate.outputs.inputsChecked == 'true'
run: npm ci
- name: Run tests
if: steps.mygate.outputs.inputsChecked == 'true'
run: npm run test
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
if: steps.mygate.outputs.inputsChecked == 'true'
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}