Skip to content

Commit

Permalink
chore: deploy to firebase with github environment
Browse files Browse the repository at this point in the history
  • Loading branch information
lihini committed Apr 30, 2024
1 parent f503533 commit 13bdbba
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/firebase-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
jobs:
deploy:
runs-on: ubuntu-latest
environment: WeatherKids_DEV
steps:
- uses: actions/checkout@v4
- name: Use Node.js
Expand All @@ -19,28 +20,28 @@ jobs:
run: echo "FIREBASE_PROJECT=$(if [ ${{ github.ref }} == 'refs/heads/main' ]; then echo 'prod'; else echo 'dev'; fi)" >> $GITHUB_ENV
- name: Install dependencies.
run: npm ci
- name: Set env vars
run: |
if [ ${{ github.ref }} == 'refs/heads/main' ]; then
DB=${{ secrets.WEATHERKIDS_DB_URL_PROD }}
FILE='.env.prod'
JWTSECRET=${{ secrets.WEATHERKIDS_JWT_SECRET_PROD }}
else
DB=${{ secrets.WEATHERKIDS_DB_URL_DEV }}
FILE='.env.dev'
JWTSECRET=secret
fi
echo "DB_FOR_BRANCH=$DB" >> $GITHUB_ENV
echo "FILE_FOR_BRANCH=$FILE" >> $GITHUB_ENV
echo "SECRET_FOR_BRANCH=$JWTSECRET" >> $GITHUB_ENV
# - name: Set env vars
# run: |
# if [ ${{ github.ref }} == 'refs/heads/main' ]; then
# DB=${{ secrets.WEATHERKIDS_DB_URL_PROD }}
# FILE='.env.prod'
# JWTSECRET=${{ secrets.WEATHERKIDS_JWT_SECRET_PROD }}
# else
# DB=${{ secrets.WEATHERKIDS_DB_URL_DEV }}
# FILE='.env.dev'
# JWTSECRET=secret
# fi
# echo "DB_FOR_BRANCH=$DB" >> $GITHUB_ENV
# echo "FILE_FOR_BRANCH=$FILE" >> $GITHUB_ENV
# echo "SECRET_FOR_BRANCH=$JWTSECRET" >> $GITHUB_ENV
- name: Make envfile
uses: SpicyPizza/[email protected]
with:
file_name: ${{ env.FILE_FOR_BRANCH }}
file_name: ${{ env.CONFIG_FILE }}
envkey_MOBILE_CLIENT_ID: ${{ secrets.MOBILE_CLIENT_ID }}
envkey_WEATHERCOM_CLIENT_ID: ${{ secrets.WEATHERCOM_CLIENT_ID }}
envkey_MONGO_URL: ${{ env.DB_FOR_BRANCH }}
envkey_JWT_SECRET: ${{ env.SECRET_FOR_BRANCH }}
envkey_MONGO_URL: ${{ secrets.MONGO_URL }}
envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }}
- name: Deploy to firebase cloud functions.
uses: w9jds/[email protected]
with:
Expand Down

0 comments on commit 13bdbba

Please sign in to comment.