This repository has been archived by the owner on Apr 25, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (55 loc) · 2.26 KB
/
build-master.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
name: build-master
on:
push:
branches:
- 'master'
jobs:
deploy-master:
permissions:
contents: read
id-token: write
runs-on: ubuntu-latest
env:
GCR_URL: gcr.io
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_REGION: europe-west1
DOCKER_BUILDKIT: 1
SERVICE: gohockey-back
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup ENV variables
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/699926043561/locations/global/workloadIdentityPools/github-dev/providers/github-dev-provider
service_account: hackathon-go-hockey@${{ env.GCP_PROJECT_ID }}.iam.gserviceaccount.com
- name: Configure Docker
id: config-docker
run: |-
gcloud --quiet auth configure-docker
- name: Build & Tag docker image
id: build-push
run: |
docker build -t ${GCR_URL}/${GCP_PROJECT_ID}/hackathon/${SERVICE}:${SHORT_SHA} .
- name: Publish docker image
id: push
run: |
docker push ${GCR_URL}/${GCP_PROJECT_ID}/hackathon/${SERVICE}:${SHORT_SHA}
- name: Deploy to Google Cloud Run
id: deploy
uses: 'google-github-actions/deploy-cloudrun@v1'
with:
region: '${{ env.GCP_REGION }}'
service: 'hackathon-${{ env.SERVICE }}'
image: 'gcr.io/${{ env.GCP_PROJECT_ID }}/hackathon/${{ env.SERVICE }}:${{ env.SHORT_SHA }}'
- name: Deploy to Google Cloud Run (demo env)
id: deploy-demo
uses: 'google-github-actions/deploy-cloudrun@v1'
with:
region: '${{ env.GCP_REGION }}'
service: 'hackathon-hockey-back-demo'
image: 'gcr.io/${{ env.GCP_PROJECT_ID }}/hackathon/${{ env.SERVICE }}:${{ env.SHORT_SHA }}'