Skip to content

Merge remote-tracking branch 'origin/staging' into 117-download-zkey-… #110

Merge remote-tracking branch 'origin/staging' into 117-download-zkey-…

Merge remote-tracking branch 'origin/staging' into 117-download-zkey-… #110

# Deploy to Firebase hosting
name: Deploy to Firebase - deploy on push
# only on selected branches
on:
push:
branches: [main, dev, staging]
jobs:
build_and_deploy_to_firebase_hosting:
defaults:
run:
working-directory: ./web
runs-on: ubuntu-latest
environment:
${{ (github.ref == 'refs/heads/main' && 'p0tion-production') ||
(github.ref == 'refs/heads/staging' && 'p0tion-staging') ||
(github.ref == 'refs/heads/dev' && 'p0tion-development') }}
steps:
- uses: actions/checkout@v3
- name: Install deps and build
run: |
echo "${{ secrets.ENV_FILE }}" > ./.env
npm install -g pnpm
npm install -g firebase-tools
pnpm install
pnpm build
- name: Write serviceAccountKey to a JSON file
uses: jsdaniell/[email protected]
with:
name: "./web/serviceAccountKey.json"
json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
# Conditional deployment based on the target branch
- name: Deploy
run: |
if [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
pnpm deploy:prod
elif [[ "${{ github.ref }}" == "refs/heads/dev" ]]; then
pnpm deploy:dev
elif [[ "${{ github.ref }}" == "refs/heads/staging" ]]; then
pnpm deploy:staging
fi
env:
GOOGLE_APPLICATION_CREDENTIALS: ./serviceAccountKey.json