-
Notifications
You must be signed in to change notification settings - Fork 7
189 lines (168 loc) · 6.19 KB
/
ci.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
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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
name: CI
on: [push, pull_request]
env:
CI: true
API_DEPLOY_PATH: packages/api/dist
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
BEACON_KEY: ${{ secrets.BEACON_KEY }}
CONTACT_US_EMAIL: ${{ secrets.CONTACT_US_EMAIL }}
COPYRIGHT_HOLDER: ${{ secrets.COPYRIGHT_HOLDER }}
FIREBASE_API_KEY: ${{ secrets.WEBAPP_FIREBASE_API_KEY }}
FIREBASE_APP_ID: ${{ secrets.WEBAPP_FIREBASE_APP_ID }}
FIREBASE_AUTH_DOMAIN: ${{ secrets.FIREBASE_AUTH_DOMAIN }}
FIREBASE_MEASUREMENT_ID: ${{ secrets.WEBAPP_FIREBASE_MEASUREMENT_ID }}
FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.WEBAPP_FIREBASE_MESSAGING_SENDER_ID }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
FIREBASE_VAPID_SERVER_KEY: ${{ secrets.WEBAPP_FIREBASE_VAPID_SERVER_KEY }}
PRIVACY_POLICY_URL: ${{ secrets.PRIVACY_POLICY_URL }}
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
services:
mongodb:
image: mongo
ports:
- 27017:27017
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- uses: actions/cache@v2
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install
- run: yarn build:schema
- run: 'yarn lint:'
- run: 'yarn assets:'
- run: 'yarn test:'
- run: 'yarn build:'
- run: yarn install:playwright_deps
- run: yarn acceptance:test
- run: yarn git_is_clean
deploy-integ:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/dev'
needs: ['build']
environment: integ
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Integ API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Integ Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}
deploy-staging:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/staging'
needs: ['build']
environment: staging
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Staging API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Staging Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}
deploy-demo:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: ['build']
environment: demo
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Demo API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Demo Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}
deploy-production:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: ['build']
environment: prod
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 16.x
- run: yarn install
- run: yarn prepare_for_deployment
env:
DB_CONNECTION_STRING: ${{ secrets.DB_CONNECTION_STRING }}
- name: 'Deploy Production API'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ secrets.API_APP_NAME }}
package: ${{ env.API_DEPLOY_PATH }}
publish-profile: ${{ secrets.API_PUBLISH_PROFILE }}
- name: Deploy Production Webapp
run: yarn build:webapp && yarn deploy:webapp
env:
API_SOCKET_URL: ${{ secrets.API_SOCKET_URL }}
API_URL: ${{ secrets.API_URL }}
INSTRUMENTATION_KEY: ${{ secrets.WEBAPP_APPINSIGHTS_KEY }}
WEBAPP_ORIGIN: ${{ secrets.WEBAPP_ORIGIN }}
WEBAPP_STORAGE_ACCOUNT: ${{ secrets.WEBAPP_STORAGE_ACCOUNT }}
WEBAPP_STORAGE_KEY: ${{ secrets.WEBAPP_STORAGE_KEY }}