-
Notifications
You must be signed in to change notification settings - Fork 1
55 lines (52 loc) · 1.57 KB
/
ui-test-deploy-prod.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: 'UI: tests & prod deploy'
on:
push:
branches:
- main
paths:
- 'ui/**'
- 'air-pollutant-map/**'
- '.github/workflows/ui-test-deploy-prod.yml'
env:
AZURE_WEBAPP_NAME: syke-prtr-p-web
AZURE_WEBAPP_PACKAGE_PATH: 'ui/build' # path to web resources
NODE_VERSION: '20.10.0'
REACT_APP_PRTR_SERVER: https://syke-prtr-fastapi-p-cont.azurewebsites.net # TODO replace with the final prod address
jobs:
test-build-deploy-prod:
name: Test, Build and Deploy (prod)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: azure/login@v1
with:
creds: ${{ secrets.PROD_AZURE_CREDENTIALS }}
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/setup-node@v2
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
cache-dependency-path: ui/package-lock.json
- name: npm ci
run: npm ci
working-directory: ui
- name: Cypress tests
run: |
npm start & npm run wait-on -- http://localhost:3000
npm run cypress:run
working-directory: ui
- name: npm build
run: npm run build
working-directory: ui
- name: add process.json
run: |
echo '{ script: "serve", env: { PM2_SERVE_SPA: "true", PM2_SERVE_HOMEPAGE: "/index.html" } }' >> build/process.json
working-directory: ui
- name: 'Deploy to Azure WebApp'
uses: azure/webapps-deploy@v2
with:
app-name: ${{ env.AZURE_WEBAPP_NAME }}
package: ${{ env.AZURE_WEBAPP_PACKAGE_PATH }}
- name: logout
run: |
az logout