1+ name : Build and Push Translator Docker Image to Github and Google Registries
2+ on :
3+ push : # TODO fix me to push on main
4+ # branches:
5+ # - main
6+
7+ env :
8+ GOOGLE_REGISTRY : europe-west6-docker.pkg.dev
9+ PROJECT_ID : metabased-testnet
10+ REPO_NAME : metabased-rollup
11+ SERVICE_NAME : metabased-translator
12+ WORKLOAD_IDENTITY_PROVIDER : projects/112197761096/locations/global/workloadIdentityPools/cloud-run-github-pool/providers/id-001
13+
14+ jobs :
15+ docker :
16+ runs-on : ubuntu-latest
17+ permissions :
18+ contents : ' read'
19+ id-token : ' write'
20+ packages : ' write'
21+
22+ steps :
23+ - name : Checkout repository
24+ uses : actions/checkout@v4
25+
26+ - name : Login to GitHub Container Registry
27+ uses : docker/login-action@v3
28+ with :
29+ registry : ghcr.io
30+ username : ${{ github.repository_owner }}
31+ password : ${{ secrets.GITHUB_TOKEN }}
32+
33+ - name : Debug Info
34+ run : |
35+ echo "Repository: ${{ github.repository }}"
36+ echo "Repository Owner: ${{ github.repository_owner }}"
37+ echo "Actor: ${{ github.actor }}"
38+ echo "Ref: ${{ github.ref }}"
39+
40+ - name : Configure Google Cloud credentials
41+ uses : google-github-actions/auth@v2
42+ with :
43+ workload_identity_provider : ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
44+ service_account : ' cloud-run-service-account@metabased-testnet.iam.gserviceaccount.com'
45+
46+ - name : Debug Google Auth
47+ run : |
48+ gcloud auth list
49+ gcloud config get-value project
50+ gcloud config get-value account
51+
52+ - name : Set up Cloud SDK
53+ uses : google-github-actions/setup-gcloud@v2
54+
55+ - name : Configure docker auth for GAR
56+ run : |
57+ gcloud auth configure-docker ${{ env.GOOGLE_REGISTRY }} --quiet
58+
59+ - name : Debug Docker Config
60+ run : |
61+ cat ~/.docker/config.json
62+ docker info
63+
64+ - name : Set up QEMU
65+ uses : docker/setup-qemu-action@v3
66+
67+ - name : Set up Docker Buildx
68+ uses : docker/setup-buildx-action@v3
69+
70+ - name : Extract metadata for Docker
71+ id : meta
72+ uses : docker/metadata-action@v5
73+ with :
74+ images : |
75+ ghcr.io/${{ github.repository }}/${{ env.SERVICE_NAME }}
76+ ${{ env.GOOGLE_REGISTRY }}/${{ env.PROJECT_ID }}/cloud-run-source-deploy/${{ env.REPO_NAME }}/${{ env.SERVICE_NAME }}
77+ tags : |
78+ type=sha,format=long
79+ type=semver,pattern={{version}}
80+ type=raw,value=latest,enable={{is_default_branch}}
81+
82+ - name : Build and push
83+ uses : docker/build-push-action@v6
84+ with :
85+ context : .
86+ platforms : linux/amd64
87+ push : true
88+ target : metabased-translator
89+ tags : ${{ steps.meta.outputs.tags }}
90+ labels : ${{ steps.meta.outputs.labels }}
91+ cache-from : type=gha
92+ cache-to : type=gha,mode=max
0 commit comments