fix: cloud functions workflow #27
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: 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: '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 services enable cloudfunctions.googleapis.com | |
gcloud functions deploy verifyOTP \ | |
--runtime nodejs18 \ | |
--trigger-http \ | |
--allow-unauthenticated \ | |
--service-account=firebase-adminsdk-bygsj@pagoda-oboarding-dev.iam.gserviceaccount.com \ | |
--region=us-central1 \ | |
--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 \ | |
--region=us-central1 \ | |
--entry-point=sendOTP \ | |
--source=lib \ | |
--set-env-vars GMAIL_SENDER="${{ secrets.GMAIL_OTP_SENDER }}",GMAIL_PASSWORD="${{ secrets.GMAIL_OTP_SENDER_PASSWORD }}" \ | |
--verbosity=debug |