-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (40 loc) · 1.53 KB
/
deploy.yaml
File metadata and controls
51 lines (40 loc) · 1.53 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
name: Deploy GCP
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
name: Run Docker
runs-on: ubuntu-latest
environment: Test
env:
IMAGE_NAME: gcr.io/${{secrets.GCP_PROJECT_ID}}/${{vars.APP_NAME}}:latest
ACCOUNT: ${{secrets.GCP_ACCOUNT_NAME}}@${{secrets.GCP_PROJECT_ID}}.iam.gserviceaccount.com
steps:
- name: Checkout repository
uses: actions/checkout@v2
- uses: space-wizards/submodule-dependency@v0.1.5
- uses: snickerbockers/submodules-init@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- id: auth
uses: 'google-github-actions/auth@v1'
with:
project_id: ${{secrets.GCP_PROJECT_ID}}
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
service_account: $ACCOUNT
- name: Setup Google SDK
uses: google-github-actions/setup-gcloud@v1
- name: Configure Docker
run: gcloud auth configure-docker --quiet
- name: Build Docker Image
run: docker build -t $IMAGE_NAME .
- name: Push Docker Image
run: docker push $IMAGE_NAME
- name: Deploy Image
run: gcloud run deploy ${{secrets.GCP_PROJECT_ID}} --image $IMAGE_NAME --region us-central1
- name: Update Service
run: gcloud run services update ${{vars.APP_NAME}} --image $IMAGE_NAME --region us-central1