Skip to content

Update deploy-cloud-functions-testnet.yml #36

Update deploy-cloud-functions-testnet.yml

Update deploy-cloud-functions-testnet.yml #36

name: Deploy Cloud Functions
on:
push:
branches: [ main, add-otp-cloud-functions ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- id: 'auth'
uses: 'google-github-actions/auth@v1'
with:
credentials_json: '${{ secrets.CLOUD_FUNCTIONS_DEPLOYER_TESTNET_SERVICE_ACCOUNT }}'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v1'
- name: 'Test Google Cloud Authentication'
run: |
gcloud config set project pagoda-oboarding-dev
gcloud auth list
gcloud projects list
- name: 'Install dependencies and build'
run: |
cd packages/functions
npm install
npm run build
echo "Directory structure after build:"
find . -type f
- name: 'Deploy Cloud Functions'
run: |
cd packages/functions
echo "Current directory contents:"
ls -R
gcloud config set project pagoda-oboarding-dev
gcloud functions deploy verifyOTP \
--runtime nodejs18 \
--trigger-http \
--allow-unauthenticated \
--service-account=firebase-adminsdk-bygsj@pagoda-oboarding-dev.iam.gserviceaccount.com \
--entry-point=verifyOTP \
--source=lib \
--set-env-vars GMAIL_SENDER="${{ secrets.GMAIL_OTP_SENDER }}",GMAIL_PASSWORD="${{ secrets.GMAIL_OTP_SENDER_PASSWORD }}" \
--verbosity=debug
gcloud functions deploy sendOTP \
--runtime nodejs18 \
--trigger-http \
--allow-unauthenticated \
--service-account=firebase-adminsdk-bygsj@pagoda-oboarding-dev.iam.gserviceaccount.com \
--entry-point=sendOTP \
--source=lib \
--set-env-vars GMAIL_SENDER="${{ secrets.GMAIL_OTP_SENDER }}",GMAIL_PASSWORD="${{ secrets.GMAIL_OTP_SENDER_PASSWORD }}" \
--verbosity=debug