-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (108 loc) · 4.37 KB
/
ci-cd.yaml
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
name: Continuous Integration & Deployment
on:
push:
branches: [master]
pull_request:
release:
types: [published]
concurrency:
group: ${{ github.ref_name }}
cancel-in-progress: true
env:
NODE_OPTIONS: "--max_old_space_size=4096"
DOCKER_REGISTRY_HOST: ${{ secrets.GCP_HOST_GCR }}
DOCKER_IMAGE: ${{ secrets.GCP_HOST_GCR }}/${{ secrets.GCP_REGISTRY_PROJECT_ID }}/${{ secrets.CLOUD_RUN_NAME }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node-yarn
- run: yarn lint
test:
name: Tests
runs-on: ubuntu-latest
env:
APP_ENV: test
container:
image: cypress/browsers:node18.12.0-chrome107
options: --user 1001
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-node-yarn
- run: yarn test src
- name: Cypress
uses: cypress-io/github-action@v6
with:
start: yarn start-test
wait-on: 'http://localhost:3000'
browser: chrome
- name: Archive test screenshots
uses: actions/upload-artifact@v3
with:
name: screenshots
path: cypress/screenshots
if: ${{ failure() }}
deploy-staging:
name: Deploy to Staging 🍾
runs-on: ubuntu-latest
needs: [lint, test]
if: github.event.ref == 'refs/heads/master'
environment: staging
steps:
- uses: actions/checkout@v4
- name: Get short SHA
id: git_short_ref
run: echo "::set-output name=ref::$(echo ${GITHUB_SHA} | cut -c1-7)"
- uses: ./.github/actions/deploy
with:
service_account_key_pusher: ${{ secrets.GCP_SA_KEY_GCR_PUSHER }}
service_account_key_deployer: ${{ secrets.GCP_SA_KEY_CLOUDRUN_DEPLOYER }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
gcp_zone: ${{ secrets.GCP_ZONE }}
gmaps_api_key: ${{ secrets.GMAPS_API_KEY }}
repository_project_id: ${{ secrets.GCP_REGISTRY_PROJECT_ID }}
cloud_run_name: ${{ secrets.CLOUD_RUN_NAME }}
react_app_api_host: ${{ secrets.REACT_APP_API_HOST }}
react_app_renaissance_host: ${{ secrets.REACT_RENAISSANCE_HOST }}
react_app_oauth_host: ${{ secrets.REACT_APP_OAUTH_HOST }}
react_app_oauth_client_id: ${{ secrets.REACT_APP_OAUTH_CLIENT_ID }}
react_app_internal_app_id: ${{ secrets.REACT_APP_INTERNAL_APP_ID }}
react_app_sentry_dsn: ${{ secrets.REACT_APP_SENTRY_DSN }}
react_app_unlayer_project_id: ${{ secrets.REACT_APP_UNLAYER_PROJECT_ID }}
react_app_mapbox_token: ${{ secrets.REACT_APP_MAPBOX_TOKEN }}
react_app_mapbox_style: ${{ secrets.REACT_APP_MAPBOX_STYLE }}
react_app_version: ${{ steps.git_short_ref.outputs.ref }}
react_app_environment: staging
deploy-prod:
name: Deploy to Prod 🍾
runs-on: ubuntu-latest
needs: [lint, test]
if: github.event_name == 'release'
environment: production
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/deploy
with:
service_account_key_pusher: ${{ secrets.GCP_SA_KEY_GCR_PUSHER }}
service_account_key_deployer: ${{ secrets.GCP_SA_KEY_CLOUDRUN_DEPLOYER }}
project_id: ${{ secrets.GCP_PROJECT_ID }}
gcp_zone: ${{ secrets.GCP_ZONE }}
gmaps_api_key: ${{ secrets.GMAPS_API_KEY }}
repository_project_id: ${{ secrets.GCP_REGISTRY_PROJECT_ID }}
cloud_run_name: ${{ secrets.CLOUD_RUN_NAME }}
react_app_api_host: ${{ secrets.REACT_APP_API_HOST }}
react_app_renaissance_host: ${{ secrets.REACT_RENAISSANCE_HOST }}
react_app_oauth_host: ${{ secrets.REACT_APP_OAUTH_HOST }}
react_app_oauth_client_id: ${{ secrets.REACT_APP_OAUTH_CLIENT_ID }}
react_app_internal_app_id: ${{ secrets.REACT_APP_INTERNAL_APP_ID }}
react_app_sentry_dsn: ${{ secrets.REACT_APP_SENTRY_DSN }}
react_app_unlayer_project_id: ${{ secrets.REACT_APP_UNLAYER_PROJECT_ID }}
react_app_mapbox_token: ${{ secrets.REACT_APP_MAPBOX_TOKEN }}
react_app_mapbox_style: ${{ secrets.REACT_APP_MAPBOX_STYLE }}
react_app_version: ${{ github.event.release.tag_name }}
react_app_environment: production