Skip to content

Commit

Permalink
Update FirebaseDeploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-amisha-i authored Jan 7, 2025
1 parent d388a04 commit fa38e07
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/FirebaseDeploy.yml
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
name: Deploy Firebase Function, Indexes and Rules

on:
push:
branches:
- main

jobs:
deploy:
runs-on: macos-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Cache Dependencies
uses: actions/cache@v4
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: Splito/functions
run: |
npm ci
- name: Install Firebase CLI
run: |
npm install -g firebase-tools
- name: Authenticate Firebase
env:
FIREBASE_SERVICE_JSON: ${{ secrets.FIREBASE_SERVICE_JSON }}
run: |
echo $FIREBASE_SERVICE_JSON | base64 --decode > functions/firebase-service-account.json
firebase auth:login:ci --token "$(firebase login:ci --json --project ${{ secrets.FIREBASE_PROJECT_ID }})"
- name: Deploy Firestore Rules and Indexes
env:
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
run: |
firebase deploy --only firestore:rules, firestore:indexes --project $FIREBASE_PROJECT_ID
- name: Deploy Cloud Functions
env:
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
run: |
firebase deploy --only functions --project $FIREBASE_PROJECT_ID

0 comments on commit fa38e07

Please sign in to comment.