-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (49 loc) · 1.71 KB
/
build-backend.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
name: Build and push backend to registry
on:
workflow_dispatch:
inputs:
cd:
description: cd
required: false
default: compose-build.yml
env:
PROJECT_ID: dataplatformcolgate
GAR_LOCATION: us-east4
SERVICE: colgate-repo
REGION: us-east4
REPOSITORY: colgate-repo
jobs:
buid-push-gcr:
permissions:
contents: read
id-token: write
actions: write
runs-on: ubuntu-latest
env:
IMAGE_NAME: backend-image
GIT_TAG: v0.1.0
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Authenticate google cloud service
id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/671371757704/locations/global/workloadIdentityPools/githubactions/providers/github
service_account: github-actions@dataplatformcolgate.iam.gserviceaccount.com
export_environment_variables: true
- name: Build docker image
run: |-
cd backend
docker buildx build --platform linux/amd64 -t "us-east4-docker.pkg.dev/$PROJECT_ID/$SERVICE/$IMAGE_NAME:latest" -t "us-east4-docker.pkg.dev/$PROJECT_ID/$SERVICE/$IMAGE_NAME:$GIT_TAG" .
- name: Authenticate docker to cloud registry
run: |-
gcloud auth configure-docker --quiet
gcloud auth configure-docker us-east4-docker.pkg.dev --quiet
- name: Push container to cloud registry
run: docker push -a us-east4-docker.pkg.dev/$PROJECT_ID/$SERVICE/$IMAGE_NAME
- name: Start frontend workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: build-frontend.yml
ref: ${{ github.ref_name }}