-
Notifications
You must be signed in to change notification settings - Fork 0
174 lines (147 loc) · 3.97 KB
/
deploy.yml
File metadata and controls
174 lines (147 loc) · 3.97 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: deploy
on:
push:
branches:
- main
pull_request:
jobs:
unit-test:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: deps and run tests
run: |
npm install
npm test -w app -- --collectCoverage
- name: prepare coverage report
run: |
mkdir coverage
cat app/coverage/lcov.info | sed 's/^SF:/SF:app\//g' > coverage/lcov.info
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
build-cli:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: install and build
run: |
npm install
npm run build -w cli
- name: archive cli-app
uses: actions/upload-artifact@v2
with:
name: cli-build
path: cli/build
build-webapp:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
- name: restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: install and build
run: |
npm install
npm run build -w app
- name: archive web-app
uses: actions/upload-artifact@v2
with:
name: app-dist
path: app/dist
e2e:
runs-on: ubuntu-latest
needs:
- build-webapp
steps:
- name: checkout
uses: actions/checkout@v2
- name: restore cache
uses: actions/cache@v2
with:
path: |
node_modules
*/node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: install
run: npm install
- name: download web app
uses: actions/download-artifact@v2
with:
name: app-dist
path: app/dist
- name: run cypress e2e tests
uses: cypress-io/github-action@v3
with:
working-directory: ./e2e
start: npm run serve-web-app
wait-on: 'http://localhost:5000'
browser: chrome
headless: true
deploy:
runs-on: ubuntu-latest
environment: netlify
if: ${{ github.ref == 'refs/heads/main' }}
needs:
- build-webapp
- unit-test
- e2e
steps:
- name: download web app
uses: actions/download-artifact@v2
with:
name: app-dist
path: app/dist
- name: deploy to netlify
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
run: npx netlify deploy --dir=app/dist --prod
release:
runs-on: ubuntu-latest
needs:
- build-cli
- build-webapp
- deploy
steps:
- name: checkout
uses: actions/checkout@v2
- name: download cli app
uses: actions/download-artifact@v2
with:
name: cli-build
path: cli/build
- name: download web app
uses: actions/download-artifact@v2
with:
name: app-dist
path: app/dist
- name: install semantic-release package
run: npm i @semantic-release/changelog @semantic-release/git --no-save
- name: release
uses: codfish/semantic-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}