CD Firebase mainnet #32
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: CD Firebase mainnet | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: mainnet | |
strategy: | |
matrix: | |
node: ['18.x'] | |
name: Node ${{ matrix.node }} CD Firebase mainnet | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
cache: 'npm' | |
cache-dependency-path: | | |
package-lock.json | |
functions/package-lock.json | |
- name: Create empty env file for mainnet build | |
run: touch .env.mainnet | |
- name: Restore mainnet env file content from secret | |
env: | |
REACT_ENV: ${{ secrets.REACT_ENV }} | |
run: echo $REACT_ENV | base64 --decode --ignore-garbage > .env.mainnet | |
- name: Create empty env file for testnet functions build | |
run: touch ./functions/.env | |
- name: Restore testnet env file content from secret | |
env: | |
FUNCTIONS_ENV: ${{ secrets.FUNCTIONS_ENV }} | |
run: echo $FUNCTIONS_ENV | base64 --decode --ignore-garbage > ./functions/.env | |
- run: ls functions -la | |
- run: npm ci | |
- run: npm run build:mainnet | |
- run: npm ci | |
working-directory: ./functions | |
- run: npm run build | |
working-directory: ./functions | |
- run: npx firebase use mainnet --token=${{ secrets.FIREBASE_TOKEN }} | |
- run: npx firebase deploy --token=${{ secrets.FIREBASE_TOKEN }} --force | |
- name: Clear env file | |
if: always() | |
run: rm .env.mainnet | |
- name: Clear functions env file | |
if: always() | |
run: rm ./functions/.env |