-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcloudbuild.yaml
More file actions
77 lines (67 loc) · 2.32 KB
/
cloudbuild.yaml
File metadata and controls
77 lines (67 loc) · 2.32 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
steps:
- id: print-variables
name: 'gcr.io/cloud-builders/gcloud'
entrypoint: 'bash'
args:
- '-c'
- |
echo "=== Default Cloud Build Substitutions ==="
echo "Project ID: ${PROJECT_ID}"
echo "Build ID: ${BUILD_ID}"
echo "=== Trigger-specific Substitutions ==="
echo "Trigger Name: ${TRIGGER_NAME}"
echo "Repository Name: ${REPO_NAME}"
echo "Branch Name: ${BRANCH_NAME}"
echo "Tag Name: ${TAG_NAME}"
echo "Ref Name: ${REF_NAME}"
echo "Service Account Email: ${SERVICE_ACCOUNT_EMAIL}"
echo "Service Account: ${SERVICE_ACCOUNT}"
echo "=== Environment Config ==="
echo "$$ENVIRONMENT_CONFIG"
secretEnv: ['ENVIRONMENT_CONFIG']
- id: 'create-environment-file'
name: 'bash'
entrypoint: 'bash'
args:
- '-c'
- |
echo "$$ENVIRONMENT_CONFIG" > src/environments/environment.ts
echo "$$ENVIRONMENT_CONFIG" > src/environments/environment.prod.ts
secretEnv: ['ENVIRONMENT_CONFIG']
- id: 'install-angular-dependencies'
name: 'node:22-alpine'
entrypoint: npm
args: ['install', '--legacy-peer-deps']
- id: 'build-angular-for-env'
name: 'node:22-alpine'
entrypoint: npm
args: ['run', 'build:$_ENV']
- id: 'build-docker-image'
name: 'gcr.io/cloud-builders/docker'
args: [
'build',
'--build-arg', 'APP_ENV=$_ENV',
'--build-arg', 'VERSION=$_VERSION',
'--build-arg', 'GIT_HASH=$SHORT_SHA',
'-t', 'gcr.io/$PROJECT_ID/$_DOCKER_IMAGE_NAME:$_VERSION',
'-t', 'gcr.io/$PROJECT_ID/$_DOCKER_IMAGE_NAME:latest',
'.'
]
- id: deploy-to-hosting-firebase
name: 'gcr.io/$PROJECT_ID/firebase'
args: ['deploy', '--only=hosting', '--project=$PROJECT_ID']
# Images to be pushed to GCR
images:
- 'gcr.io/$PROJECT_ID/$_DOCKER_IMAGE_NAME:$_VERSION'
- 'gcr.io/$PROJECT_ID/$_DOCKER_IMAGE_NAME:latest'
# Secrets you have to create in the secret manager and give access to the service account
availableSecrets:
secretManager:
- versionName: projects/$PROJECT_ID/secrets/environment_secret/versions/latest
env: 'ENVIRONMENT_CONFIG'
options:
logging: CLOUD_LOGGING_ONLY
substitutions:
_ENV: prod
_VERSION: v0.0.0 # Should be overridden by trigger or passed via --substitutions
_DOCKER_IMAGE_NAME: dataclouder-front