-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (79 loc) · 3.01 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: build-and-deployment
on:
push:
branches:
- feature/10-continuous-deployment-for-gen2-function
# - main
jobs:
deploy-staging:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/feature/10-continuous-deployment-for-gen2-function'
steps:
- uses: 'actions/checkout@v3'
- run: ls
- id: 'auth'
name: 'Authenticate to Google Cloud'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
- name: Debug GCP credentials
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
run: |
echo "$GOOGLE_APPLICATION_CREDENTIALS" > credentials.json
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
with:
version: '>= 363.0.0'
- name: 'Use gcloud CLI'
run: 'gcloud info'
- name: Install Python dependencies
run: |
pip install -r requirements.txt
- name: 'Deploy a gen 2 cloud function'
run: |
gcloud functions deploy whatsapp-webhook-analytics-staging \
--gen2 \
--runtime=python312 \
--region=asia-south1 \
--trigger-http \
--entry-point=handle_payload \
--memory=256MB \
--timeout=30s \
--set-env-vars=FLASK_APP=${{ secrets.FLASK_APP_STAGING }},DB_USER=${{ secrets.DB_USER }},DB_PASSWORD=${{ secrets.DB_PASSWORD }},DB_NAME=${{ secrets.DB_NAME }},DB_PORT=${{ secrets.DB_PORT }},CONNECTION_NAME=${{ secrets.CONNECTION_NAME }},LOGGING_LEVEL=${{ secrets.LOGGING_LEVEL }}
# deploy-production:
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'
# steps:
# - uses: 'actions/checkout@v3'
# - run: ls
# - id: 'auth'
# name: 'Authenticate to Google Cloud'
# uses: 'google-github-actions/auth@v1'
# with:
# credentials_json: '${{ secrets.GCP_CREDENTIALS }}'
# - name: Debug GCP credentials
# env:
# GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }}
# run: |
# echo "$GOOGLE_APPLICATION_CREDENTIALS" > credentials.json
# - name: 'Set up Cloud SDK'
# uses: 'google-github-actions/setup-gcloud@v1'
# with:
# version: '>= 363.0.0'
# - name: 'Use gcloud CLI'
# run: 'gcloud info'
# - name: Install Python dependencies
# run: |
# pip install -r requirements.txt
# - name: 'Deploy a gen 2 cloud function'
# run: |
# gcloud functions deploy admindashboard-webhook-queue-service-prod \
# --gen2 \
# --runtime=python312 \
# --region=asia-south1 \
# --trigger-http \
# --entry-point=handle_payload \
# --memory=256MB \
# --timeout=30s \
# --set-env-vars=FLASK_APP=${{ secrets.FLASK_APP_STAGING }},DB_USER=${{ secrets.DB_USER }},DB_PASSWORD=${{ secrets.DB_PASSWORD }},DB_NAME=${{ secrets.DB_NAME }},DB_PORT=${{ secrets.DB_PORT }},CONNECTION_NAME=${{ secrets.CONNECTION_NAME }},LOGGING_LEVEL=${{ secrets.LOGGING_LEVEL }}