Skip to content

Add user via name and contact (#106) #66

Add user via name and contact (#106)

Add user via name and contact (#106) #66

name: Deploy Firebase Function
on:
push:
branches:
- main
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
name: Checkout
- uses: actions/setup-node@v4
name: Setup Node.js
with:
node-version: 20
- uses: actions/cache@v4
name: Cache Dependencies
id: cache-dependencies
with:
path: |
~/.npm
~/.cache/firebase
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
working-directory: khelo/functions
run: |
npm ci
- name: Install Firebase CLI
run: npm install -g firebase-tools
- name: Prepare Google Application Credentials
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
FIREBASE_JSON_BASE64: ${{ secrets.FIREBASE_JSON_BASE64 }}
run: |
cd khelo
echo $GOOGLE_APPLICATION_CREDENTIALS | base64 --decode > functions/google-application-credentials.json
echo $FIREBASE_JSON_BASE64 | base64 --decode > firebase.json
- name: Deploy Firebase functions
run: |
cd khelo
export GOOGLE_APPLICATION_CREDENTIALS=$(pwd)/functions/google-application-credentials.json
firebase deploy --only functions --debug
- name: Remove credentials file
if: success() || failure()
run: |
cd khelo
rm functions/google-application-credentials.json