GitHub Integration
Automate your Firebase Hosting deployments with GitHub Actions.
Quick Setup​
-
Get Service Account Key
firebase init hosting:github
-
Add GitHub Action
name: Deploy to Firebase
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: live
PR Preview Deployments​
Automatically create preview channels for pull requests:
on:
pull_request:
types: [opened, synchronize]
jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: npm ci && npm run build
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
channelId: pr-${{ github.event.number }}
Coming Soon​
This documentation is being expanded. For now, please refer to:
- Preview Channels for testing workflows
- Official GitHub Action