-
Notifications
You must be signed in to change notification settings - Fork 57
54 lines (41 loc) · 1.85 KB
/
deploy.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
50
51
52
53
54
# Copyright 2022 Jeffrey M Hodges.
# SPDX-License-Identifier: Apache-2.0
name: Deploy
on:
workflow_call:
concurrency: production
permissions:
id-token: write # For Google OIDC workload identity things
contents: read
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v4
- id: auth
uses: google-github-actions/[email protected]
with:
workload_identity_provider: "projects/852340051888/locations/global/workloadIdentityPools/github-deploy/providers/github-deploy"
service_account: "[email protected]"
create_credentials_file: true
- id: get-gke-credentials
uses: google-github-actions/[email protected]
with:
cluster_name: dg
location: us-central1-c
- id: gcloud-config-docker
run: gcloud auth configure-docker -q us-central1-docker.pkg.dev
- id: docker-build
run: docker build -t us-central1-docker.pkg.dev/personal-sites-1295/deploys/howsmyssl:v1-${GITHUB_SHA} .
- id: docker-push
run: docker push us-central1-docker.pkg.dev/personal-sites-1295/deploys/howsmyssl:v1-${GITHUB_SHA}
- id: sha256-of-docker-image
run: echo "IMAGE_WITH_SHA256=$(docker inspect --format='{{index .RepoDigests 0}}' us-central1-docker.pkg.dev/personal-sites-1295/deploys/howsmyssl:v1-${GITHUB_SHA})" >> "$GITHUB_OUTPUT"
- id: check-output
run: echo "found as ${{steps.sha256-of-docker-image.outputs.IMAGE_WITH_SHA256}}"
- id: update-deploy
run: kubectl -n prod set image deployment/howsmyssl howsmyssl=${{ steps.sha256-of-docker-image.outputs.IMAGE_WITH_SHA256 }}
- id: rollout-status
run: kubectl -n prod rollout status --timeout=5m deployments/howsmyssl