Repository navigation
fix(deps): fix the fail to authenticate for firebase #83
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: | |
| - dev | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build Localized Project | |
| # This builds all locales into the output directory | |
| run: npm run build -- --localize | |
| - name: Decode Service Account | |
| id: decode_sa | |
| run: | | |
| echo "decoded_json<<EOF" >> $GITHUB_OUTPUT | |
| if echo "$SA_KEY" | grep -q "^ewog"; then | |
| echo "Decoding Base64 service account..." | |
| echo "$SA_KEY" | base64 --decode >> $GITHUB_OUTPUT | |
| else | |
| echo "Service account is already raw JSON." | |
| echo "$SA_KEY" >> $GITHUB_OUTPUT | |
| fi | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| env: | |
| SA_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT_KEY }} | |
| - name: Deploy to Firebase Hosting | |
| uses: FirebaseExtended/action-hosting-deploy@v0 | |
| with: | |
| repoToken: '${{ secrets.GITHUB_TOKEN }}' | |
| firebaseServiceAccount: '${{ steps.decode_sa.outputs.decoded_json }}' | |
| # Use 'dev' target for dev branch, 'prod' target for main branch | |
| target: ${{ github.ref == 'refs/heads/main' && 'prod' || 'dev' }} | |
| channelId: live |