-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathstage.yaml
More file actions
79 lines (71 loc) · 2.27 KB
/
stage.yaml
File metadata and controls
79 lines (71 loc) · 2.27 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
timeout: 2700s # Set build timeout to 45 mins
steps:
- id: 'install'
name: node:16
entrypoint: npm
args: ['ci']
- id: 'prepare'
name: node:16
entrypoint: bash
args:
- '-c'
- |
npm run stage:github determineDeploymentType &&
npm run stage:github announceDeploymentStart
- id: 'build'
name: node:16
env:
- 'CI=true'
- 'NODE_OPTIONS="--max_old_space_size=8192"'
- 'ELEVENTY_IGNORE_NACL=true'
entrypoint: bash
args:
- '-c'
- |
npm run stage:github buildStaticSite
- id: 'deploy'
name: 'gcr.io/cloud-builders/gcloud'
entrypoint: bash
args:
- '-c'
# Copy, /en/ to root of /dist, to be able to serve English from /
# without further redirects, remove the leftovers and upload everything
# to Cloud Storage, remove afterwards to not include it in the instance image
- |
echo "Starting deployment ..."
cat gulp-tasks/stageGitHub/tmp/deploymentType.txt
if [ ! -z "$(cat gulp-tasks/stageGitHub/tmp/deploymentType.txt)" ]; then
cp -rf dist/en/* dist/ &&
rm -rf dist/en &&
echo "Uploading files ..."
gsutil -m rsync -r dist gs://static-dcc-staging/pr-$_PR_NUMBER
echo "Done uploading!"
rm -rf dist
fi
if [[ "$(cat gulp-tasks/stageGitHub/tmp/deploymentType.txt)" = "app" ]]; then
gcloud app deploy --version pr-$_PR_NUMBER-app --no-promote --project dcc-staging
fi
- id: 'finalize'
name: node:16
entrypoint: bash
args:
- '-c'
- |
npm run stage:github announceDeploymentFinished
options:
machineType: 'E2_HIGHCPU_32'
env:
- 'BRANCH_NAME=$BRANCH_NAME'
- 'HEAD_REPO_URL=$_HEAD_REPO_URL'
- 'REPO_NAME=$REPO_NAME'
- 'COMMIT_SHA=$COMMIT_SHA'
- 'PR_NUMBER=$_PR_NUMBER'
secretEnv: ['GITHUB_APP_ID', 'GITHUB_APP_KEY', 'GITHUB_APP_INSTALLATION_ID']
availableSecrets:
secretManager:
- versionName: projects/dcc-staging/secrets/GITHUB_APP_ID/versions/1
env: 'GITHUB_APP_ID'
- versionName: projects/dcc-staging/secrets/GITHUB_APP_KEY/versions/1
env: 'GITHUB_APP_KEY'
- versionName: projects/dcc-staging/secrets/GITHUB_APP_INSTALLATION_ID/versions/1
env: 'GITHUB_APP_INSTALLATION_ID'