forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
93 lines (82 loc) · 2.15 KB
/
cloudbuild.yaml
File metadata and controls
93 lines (82 loc) · 2.15 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
steps:
- name: node:20.10.0-alpine
id: install
dir: frontend
entrypoint: npm
args: ['ci', '--no-optional']
- name: node:20.10.0-alpine
id: lint
dir: frontend
entrypoint: npm
args: ['run', 'lint']
- name: node:20.10.0-alpine
id: lingui-extract
dir: frontend
entrypoint: ash
args:
- '-c'
- |
npm run extract | tee /workspace/lingui-extract-output.txt
- name: node:20.10.0-alpine
id: lingui-translation-check
dir: frontend
entrypoint: ash
args:
- '-c'
- |
output=$( awk -F '│' '/fr/ { gsub(/^[ \t]+|[ \t]+$/, "", $4); print $4 }' /workspace/lingui-extract-output.txt )
# Check if there are any missed french translations
if [ "$output" -eq 0 ]; then
echo "All translations are up to date, proceeding."
else
echo "There are $output missed translations, please update them before proceeding."
exit 1
fi
- name: node:20.10.0-alpine
id: lingui-compile
dir: frontend
entrypoint: npm
args: ['run', 'compile']
- name: node:20.10.0-alpine
id: test
dir: frontend
entrypoint: npm
args: ['test']
- name: node:20.10.0-alpine
id: build-production-bundle
dir: frontend
entrypoint: npm
args: ['run', 'build']
- name: 'gcr.io/cloud-builders/docker'
id: generate-image-name
entrypoint: 'bash'
dir: frontend
args:
- '-c'
- |
echo "northamerica-northeast1-docker.pkg.dev/track-compliance/tracker/frontend:$(echo $BRANCH_NAME | sed 's/[^a-zA-Z0-9]/-/g')-$SHORT_SHA-$(date +%s)" > /workspace/imagename
- name: 'gcr.io/cloud-builders/docker'
id: build
entrypoint: 'bash'
dir: frontend
args:
- '-c'
- |
image=$(cat /workspace/imagename)
docker build -t $image .
- name: 'gcr.io/cloud-builders/docker'
id: push-if-master
entrypoint: 'bash'
args:
- '-c'
- |
if [[ "$BRANCH_NAME" == "master" ]]
then
image=$(cat /workspace/imagename)
docker push $image
else
exit 0
fi
timeout: 1200s
options:
machineType: 'E2_HIGHCPU_8'