-
Notifications
You must be signed in to change notification settings - Fork 59
83 lines (67 loc) · 2.89 KB
/
Copy pathdocker-publish.yml
File metadata and controls
83 lines (67 loc) · 2.89 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Build & Push Docker Image to Artifact Registry
on:
push:
branches:
- release
permissions:
id-token: write
contents: read
concurrency:
group: docker-publish-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
workload_identity_provider: projects/840384202515/locations/global/workloadIdentityPools/github-pool/providers/github-provider
service_account: github-deployer@breeze-automatic-prod.iam.gserviceaccount.com
- name: Configure Docker for Artifact Registry
run: |
gcloud auth configure-docker asia-south1-docker.pkg.dev --quiet
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract short SHA
run: echo "SHORT_SHA=${GITHUB_SHA:0:8}" >> $GITHUB_ENV
- name: Get GCP Access Token for Docker Build
run: |
ACCESS_TOKEN=$(gcloud auth print-access-token)
echo "GCP_ACCESS_TOKEN=$ACCESS_TOKEN" >> $GITHUB_ENV
- name: Build and Push Docker Image to Artifact Registry
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64
tags: asia-south1-docker.pkg.dev/breeze-automatic-prod/clairvoyance/clairvoyance:${{ env.SHORT_SHA }}
build-args: |
KRISP_BUCKET_PATH=gs://breeze-clairvoyance-models/krisp
AIC_BUCKET_PATH=gs://breeze-clairvoyance-models/aic
secrets: |
gcp_token=${{ env.GCP_ACCESS_TOKEN }}
provenance: false
sbom: false
# =================================================================
# AUTOMATED BETA DEPLOYMENT
# =================================================================
- name: Get GKE Credentials
uses: google-github-actions/get-gke-credentials@v3
with:
cluster_name: breeze-automatic-mum-01
location: asia-south1
project_id: breeze-automatic-prod
use_dns_based_endpoint: true
- name: Deploy to GKE Beta Namespace
run: |
echo "🚀 Updating beta deployment to tag: ${{ env.SHORT_SHA }}"
# 3. Seamlessly switch the deployment container image over to the fresh git commit hash
kubectl set image deployment/clairvoyance-beta \
clairvoyance-sha256-1=asia-south1-docker.pkg.dev/breeze-automatic-prod/clairvoyance/clairvoyance:${{ env.SHORT_SHA }} \
-n beta
# 4. Watch the deployment update progress live to ensure a healthy rolling update
kubectl rollout status deployment/clairvoyance-beta -n beta --timeout=5m
echo "🎉 Automated deployment to beta namespace completed successfully!"