-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (33 loc) · 1.09 KB
/
gcp_publish.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
# This workflow will build a docker container and publish it to Google Container Registry
name: Production build and publish
on:
push:
branches:
- master
env:
REGISTRY_HOSTNAME: eu.gcr.io
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GITHUB_SHA: ${{ github.sha }}
jobs:
backend:
name: build and publish backend
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GKE_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Setup docker gcloud auth
run: |
# configure docker to authenticate via gcloud command-line tool
gcloud auth configure-docker
- name: Build backend docker image
run: |
docker build -t "$REGISTRY_HOSTNAME"/"$GKE_PROJECT"/maguire-backend:"$GITHUB_SHA" backend
- name: Publish backend docker image
run: |
docker push $REGISTRY_HOSTNAME/$GKE_PROJECT/maguire-backend:$GITHUB_SHA