Fix deploy functions 18 #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 to DEV | |
on: | |
push: | |
branches: | |
- stg | |
workflow_dispatch: | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Step 1: Checkout the code | |
- uses: actions/checkout@v3 | |
# Step 1.5: Environment variables | |
- name: create env file | |
working-directory: backend | |
run: | | |
cd functions | |
touch .env | |
echo "${{ secrets.FUNCTIONS_ENV_VARS }}" >> .env | |
# Step 2: Set up Python environment | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.10' | |
# Step 3: Set up Node.js environment | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 19.7.0 | |
# Step 4: Create Service Account Key and Set Env Variables | |
- name: Create SA key and set env variables | |
run: | | |
echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SCHEMESSG_V3_DEV }}' > ${{ runner.temp }}/gcloud.json | |
echo "GOOGLE_APPLICATION_CREDENTIALS=${{ runner.temp }}/gcloud.json" >> $GITHUB_ENV | |
# Step 5: Prepare the environment | |
- name: Prepare the environment | |
working-directory: backend/functions | |
run: | | |
python3.10 -m venv venv | |
. venv/bin/activate | |
npx firebase-tools --version | |
python3.10 -m pip install -r requirements.txt | |
# Step 6: deploy functions | |
- name: Deploy functions | |
working-directory: backend | |
env: | |
GOOGLE_APPLICATION_CREDENTIALS: ${{ runner.temp }}/gcloud.json | |
run: npx firebase-tools deploy --only functions --debug --token "${{ secrets.FIREBASE_TOKEN_SCHEMESSG_V3_DEV }}" |