-
Notifications
You must be signed in to change notification settings - Fork 1
42 lines (39 loc) · 1.25 KB
/
google.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
name: Build and Deploy to GKE
on:
push:
branches:
- master
env:
GKE_PROJECT: ${{ secrets.GKE_PROJECT }}
GKE_EMAIL: ${{ secrets.GKE_EMAIL }}
GITHUB_SHA: ${{ github.sha }}
GKE_ZONE: europe-north1
GKE_REGION: europe-north1
IMAGE: registry
REGISTRY_HOSTNAME: gcr.io
DEPLOYMENT_NAME: registry
jobs:
setup-build-publish-deploy:
name: Setup, Build, Publish, and Deploy
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true
- run: git fetch --all --prune --unshallow --tags --recurse-submodules-default=yes
- uses: google-github-actions/auth@v0
with:
service_account: ${{ secrets.GKE_EMAIL }}
credentials_json: ${{ secrets.GKE_KEY }}
project_id: ${{ secrets.GKE_PROJECT }}
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
- run: |
gcloud auth configure-docker
- name: Build
run: |
gcloud builds submit --tag "$REGISTRY_HOSTNAME"/"$GKE_PROJECT"/"$IMAGE":"$GITHUB_SHA"
- name: Deploy
run: |
gcloud run deploy "$DEPLOYMENT_NAME" --image "$REGISTRY_HOSTNAME"/"$GKE_PROJECT"/"$IMAGE":"$GITHUB_SHA" --platform managed --region "$GKE_REGION" --allow-unauthenticated