chore: update API version #97
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 NestJS API to Firebase | |
on: | |
push: | |
branches: | |
# - main | |
- dev | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: WeatherKids_DEV | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Set correct firebase project based on git branch. | |
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: Make envfile | |
uses: SpicyPizza/[email protected] | |
with: | |
file_name: ${{ env.CONFIG_FILE }} | |
envkey_MOBILE_CLIENT_ID: ${{ secrets.MOBILE_CLIENT_ID }} | |
envkey_WEATHERCOM_CLIENT_ID: ${{ secrets.WEATHERCOM_CLIENT_ID }} | |
envkey_MONGO_URL: ${{ secrets.MONGO_URL }} | |
envkey_JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
- name: Deploy to firebase cloud functions. | |
uses: w9jds/[email protected] | |
with: | |
args: deploy --only functions --project ${{ env.FIREBASE_PROJECT }} --non-interactive --debug | |
env: | |
GCP_SA_KEY: ${{ secrets.GITHUBDEPLOY_GCP_SERVICE_ACCOUNT }} |