Skip to content

deploy-to-firebase-functions #64

deploy-to-firebase-functions

deploy-to-firebase-functions #64

name: deploy-to-firebase-functions
on:
push:
branches:
- master
paths:
- 'functions/**'
workflow_dispatch:
inputs:
name:
description: 'Enter the name of this workflow trigger'
required: true
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Into the repo
uses: actions/checkout@v3
- name: Setup node environment
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install necessary npm packages in the functions
run: npm ci
working-directory: ./functions
- name: Install firebase CLI
run: npm install -g firebase-tools@12
# https://firebase.google.com/docs/cli#cli-ci-systems
- name: Authenticate Firebase CLI with service account key
run: echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }}' > $HOME/gcp-key.json
- name: Deploy to Firebase functions
run: export GOOGLE_APPLICATION_CREDENTIALS=$HOME/gcp-key.json &&
npx firebase-tools deploy --project ${{ secrets.GCP_PROJECT_ID }} --only functions --json
working-directory: ./functions