Merge pull request #75 from DostEducation/revert-74-revert-73-revert-… #63
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: python38 | |
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: python38 | |
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 }} |