-
Notifications
You must be signed in to change notification settings - Fork 9
46 lines (39 loc) · 1.42 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
name: "Deploy to Cloud Run"
on:
push:
env:
DOCKER_IMAGE_URL: ${{ vars.GCP_GAR_LOCATION }}-docker.pkg.dev/${{ vars.GCP_PROJECT_ID }}/${{ vars.GCP_REPO }}/${{ vars.GCP_APP }}/${{ github.sha }}
SERVICE: ${{ vars.GCP_SERVICE }}
PROJECT_ID: ${{ vars.GCP_PROJECT_ID }}
SERVICE_ACCOUNT: ${{ vars.GCP_SERVICE_ACCOUNT }}
WORKLOAD_IDENTITY_PROVIDER: ${{ vars.GCP_WORKLOAD_IDENTITY_PROVIDER }}
GAR_LOCATION: ${{ vars.GCP_GAR_LOCATION }}
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Google auth
id: auth
uses: google-github-actions/auth@v2
with:
token_format: 'access_token'
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ env.SERVICE_ACCOUNT }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
with:
project_id: ${{ env.PROJECT_ID }}
- name: Docker Auth
run: |-
gcloud auth configure-docker ${{ env.GAR_LOCATION }}-docker.pkg.dev
docker build -t ${{ env.DOCKER_IMAGE_URL }} --file Dockerfile .
docker push ${{ env.DOCKER_IMAGE_URL }}
- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v1
with:
service: ${{ env.SERVICE }}
image: ${{ env.DOCKER_IMAGE_URL }}