fix: update Firebase deployment steps for improved service account ha… #13
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 Hosting | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| # - name: Setup Node.js | |
| # uses: actions/setup-node@v4 | |
| # with: | |
| # node-version: '20' | |
| # cache: 'pnpm' | |
| # cache-dependency-path: pnpm-lock.yaml | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build | |
| - name: Deploy Frontend to Firebase Hosting | |
| uses: FirebaseExtended/action-hosting-deploy@v0 | |
| with: | |
| repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
| firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_THINGS_TO_COMPLETE }}" | |
| channelId: live | |
| projectId: things-to-complete | |
| - name: Deploy Functions | |
| run: | | |
| npm install -g firebase-tools | |
| echo $FIREBASE_SERVICE_ACCOUNT > ./firebase-service-account.json} | |
| firebase login:ci --service-account=./firebase-service-account.json | |
| firebase deploy --only functions | |
| env: | |
| FIREBASE_SERVICE_ACCOUNT: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_THINGS_TO_COMPLETE }}" | |
| FIREBASE_PROJECT_ID: things-to-complete |