This file contains hidden or 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 to Firebase Functions on merge | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| build_and_deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Cache npm Dependencies | |
| uses: actions/cache@v4 | |
| id: cache-npm | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install npm Dependencies | |
| run: npm ci | |
| working-directory: functions | |
| # echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" | |
| # export GOOGLE_APPLICATION_CREDENTIALS=$GITHUB_WORKSPACE/gcp_credentials.json | |
| - name: Create file - gcp_credentials.json | |
| run: | | |
| echo '${{ secrets.FIREBASE_SERVICE_ACCOUNT_JSON_STRING }}' | jq '.' > gcp_credentials.json | |
| working-directory: functions | |
| - name: Create file - .env | |
| run: | | |
| echo "TEST_ENV=${{ vars.TEST_ENV }}" > .env | |
| echo "GCP_PROJECT_NUMBER=${{ vars.GCP_PROJECT_NUMBER }}" >> .env | |
| working-directory: functions | |
| - name: Deploy Firebase Functions | |
| run: | | |
| npm run deploy | |
| working-directory: functions |