-
Notifications
You must be signed in to change notification settings - Fork 1
39 lines (39 loc) · 1.16 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
name: deploy prod
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
environment: prod
permissions:
contents: 'read'
id-token: 'write'
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: log in to GCP
id: auth
uses: google-github-actions/auth@v2
with:
token_format: access_token
project_id: ${{ secrets.PROJECT_ID }}
workload_identity_provider: ${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}
service_account: ${{ secrets.DEPLOY_SERVICE_ACCOUNT }}
- name: Login to Artifact Registry
uses: docker/login-action@v3
with:
registry: ${{ vars.DOCKER_REGISTRY }}
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Build service
uses: docker/build-push-action@v2
with:
push: true
tags: ${{ secrets.DOCKER_REPO }}/api:latest
- name: deploy to cloud run
uses: google-github-actions/deploy-cloudrun@v2
with:
service: 'api-prod'
image: ${{ secrets.DOCKER_REPO }}/api:latest