-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (71 loc) · 2.25 KB
/
build.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Integration Client JS Build
on: push
env:
NPM_TOKEN: ${{ secrets.NPM_PUBLISHER_TOKEN }}
GH_TOKEN: ${{ secrets.SEMANTIC_RELEASE_GH_TOKEN }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
test:
name: Tests 🚦
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Use correct Node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: ${{ steps.cache_node_modules.outputs.cache-hit != 'true' }}
continue-on-error: true
run: |
npm config set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm i
- name: Run tests
run: npm run code-style && npm test
- name: Slack notification
uses: 8398a7/action-slack@a189acbf0b7ea434558662ae25a0de71df69a435
if: ${{ failure() }}
with:
status: ${{ job.status }}
fields: repo,message,author,job,ref
job_name: Test 🚦
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
deploy:
name: Deploy 🚢
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Use correct Node version
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Cache node_modules
id: cache_node_modules
uses: actions/cache@v3
with:
path: node_modules
key: node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Release package
if: github.ref_name == 'master'
run: |
npm run build
CI=true npm run semantic-release
- name: Slack notification
uses: 8398a7/action-slack@a189acbf0b7ea434558662ae25a0de71df69a435
with:
status: ${{ job.status }}
fields: repo,message,author,job,ref
job_name: Deploy 🚢
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
if: always()