Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create deploy_functions.yml #67

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/deploy_functions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy to Firebase Functions

on:
push:
branches:
- stg
workflow_dispatch:

env:
FIREBASE_PROJECT_ID: "schemessg-v3-dev"
SERVICE_ACCOUNT_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_SCHEMESSG_V3_DEV }}

jobs:
deploy:
name: Deploy Functions
runs-on: ubuntu-latest

steps:
# Step 1: Checkout the code
- name: Checkout Repository
uses: actions/checkout@v3

# Step 2: Set up Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

# Step 3: Set up Python environment (since your backend relies on Python as well)
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.10

# Step 4: Install Dependencies
- name: Install Dependencies
run: |
npm install -g [email protected]
cd functions
python -m venv venv
source venv/bin/activate
pip install --no-cache-dir -r requirements.txt

# Step 5: Authenticate Firebase CLI
- name: Authenticate Firebase CLI
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN_SCHEMES_V3_DEV }}
run: |
echo "$SERVICE_ACCOUNT_KEY" > ${HOME}/serviceAccountKey.json
firebase auth:login:ci --project $FIREBASE_PROJECT_ID --token $FIREBASE_TOKEN
firebase use --add $FIREBASE_PROJECT_ID --token $FIREBASE_TOKEN

# Step 6: Deploy All Functions
- name: Deploy Firebase Functions
run: |
firebase deploy --only functions --project $FIREBASE_PROJECT_ID
env:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
GOOGLE_APPLICATION_CREDENTIALS: ${HOME}/serviceAccountKey.json
Loading