-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: deploy to firebase with github environment
- Loading branch information
Showing
1 changed file
with
18 additions
and
17 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ on: | |
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
environment: WeatherKids_DEV | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js | ||
|
@@ -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: | ||
|