-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (58 loc) · 2.08 KB
/
deploy.yml
File metadata and controls
68 lines (58 loc) · 2.08 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: Deploy to Cloud Run
on:
push:
branches:
- main
workflow_dispatch:
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
SERVICE_NAME: odyssey-hackathon
REGION: europe-west1
AR_REPO: europe-west1-docker.pkg.dev
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Google Auth
id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
- name: Authorize Docker push
run: gcloud auth configure-docker ${{ env.AR_REPO }}
- name: Create Artifact Registry repo if not exists
run: |
gcloud artifacts repositories describe ${{ env.SERVICE_NAME }} \
--location=${{ env.REGION }} \
--project=${{ env.PROJECT_ID }} 2>/dev/null || \
gcloud artifacts repositories create ${{ env.SERVICE_NAME }} \
--repository-format=docker \
--location=${{ env.REGION }} \
--project=${{ env.PROJECT_ID }}
- name: Build and Push Container
run: |
IMAGE=${{ env.AR_REPO }}/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
docker build -t $IMAGE .
docker push $IMAGE
- name: Deploy to Cloud Run
uses: google-github-actions/deploy-cloudrun@v2
with:
service: ${{ env.SERVICE_NAME }}
image: ${{ env.AR_REPO }}/${{ env.PROJECT_ID }}/${{ env.SERVICE_NAME }}/${{ env.SERVICE_NAME }}:${{ github.sha }}
region: ${{ env.REGION }}
flags: |
--max-instances=1
--min-instances=1
--memory=2Gi
--timeout=600
--concurrency=80
env_vars: |
DEBUG=False
ALLOWED_HOSTS=*
CSRF_TRUSTED_ORIGINS=https://odyssey-hackathon-887426494699.europe-west1.run.app
GOOGLE_API_KEY=${{ secrets.GOOGLE_API_KEY }}
ODYSSEY_API_KEY=${{ secrets.ODYSSEY_API_KEY }}