-
Notifications
You must be signed in to change notification settings - Fork 1
53 lines (53 loc) · 1.58 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
name: deploy prod
on:
push:
branches:
- main
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: chartboost/ruff-action@v1
mypy:
needs: [ruff]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: pip install -r requirements.txt
- run: pip install mypy
- run: mypy --install-types --non-interactive --explicit-package-bases --disable-error-code import-untyped .
deploy:
needs: [ruff, mypy]
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