-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (53 loc) · 2.57 KB
/
build.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
54
55
56
57
58
59
60
name: build-and-deployment
on:
push:
branches:
- develop
- main
jobs:
# build and test jobs will be added later one we have unit tests in place
deploy-staging:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/develop'
steps:
- uses: 'actions/checkout@v3'
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- id: 'deploy-staging'
uses: 'google-github-actions/deploy-cloud-functions@v0'
with:
name: kookoo-callback-staging
region: asia-south1
description: 'Deploying staging function'
memory_mb: 256
timeout: 30
runtime: python311
project_id: ${{ secrets.GCP_PROJECT_ID }}
entry_point: callback
max_instances: 0 # Remove limitation
env_vars: FLASK_ENV=${{ secrets.FLASK_ENV }},TESTING=${{ secrets.TESTING }},DEBUG=${{ secrets.DEBUG }},DB_USER=${{ secrets.DB_USER }},DB_PASSWORD=${{ secrets.DB_PASSWORD }},DB_NAME=${{ secrets.DB_NAME }},DB_PORT=${{ secrets.DB_PORT }},SECRET_KEY=${{ secrets.SECRET_KEY }},CONNECTION_NAME=${{ secrets.CONNECTION_NAME }},RETRY_LOGS_BATCH_LIMIT=1000,MAX_RETRY_ATTEMPTS_FOR_LOGS=3
deploy-production:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: 'actions/checkout@v3'
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- id: 'deploy-production'
uses: 'google-github-actions/deploy-cloud-functions@v0'
with:
name: kookoo-callback
region: asia-south1
description: 'Deploying production function'
memory_mb: 512
timeout: 120
runtime: python311
project_id: ${{ secrets.GCP_PROJECT_ID }}
entry_point: callback
max_instances: 0 # Remove limitation
env_vars: FLASK_ENV=${{ secrets.FLASK_ENV_PROD }},TESTING=${{ secrets.TESTING_PROD }},DEBUG=${{ secrets.DEBUG_PROD }},DB_USER=${{ secrets.DB_USER_PROD }},DB_PASSWORD=${{ secrets.DB_PASSWORD_PROD }},DB_NAME=${{ secrets.DB_NAME_PROD }},DB_PORT=${{ secrets.DB_PORT_PROD }},SECRET_KEY=${{ secrets.SECRET_KEY_PROD }},CONNECTION_NAME=${{ secrets.CONNECTION_NAME_PROD }},RETRY_LOGS_BATCH_LIMIT=${{ secrets.RETRY_LOGS_BATCH_LIMIT_PROD }},MAX_RETRY_ATTEMPTS_FOR_LOGS=${{ secrets.MAX_RETRY_ATTEMPTS_FOR_LOGS_PROD }},DB_HOST=${{ secrets.DB_HOST_PROD }}
vpc_connector: projects/${{ secrets.PROJECT_ID }}/locations/${{ secrets.VPC_CONNECTOR_REGION }}/connectors/${{ secrets.VPC_CONNECTOR_NAME }}