Deploy to live & preview channels via GitHub pull requests Stay organized with collections Save and categorize content based on your preferences.
You can integrate deploys toFirebase Hosting via a GitHub Action. Here'swhat this GitHub Action can do for you:
Creates a new preview channel (and its associated preview URL) for every PR onyour GitHub repository.
Adds a comment to the PR with the preview URLso that you and each reviewer can view and test the PR's changes in a"preview" version of your app.


Updates the preview URL with changes from each commit by automaticallydeploying to the associated preview channel. The URL doesn't change with eachnew commit.
(Optional) Deploys the current state of your GitHub repo to your livechannel when the PR is merged.
Reminder: When using preview URLs, your app interacts with thereal backendresources of your Firebase project.
Set up the GitHub Action to deploy toFirebase Hosting
Create a GitHub repository (public or private) or use an existing one. Youmust have admin permissions for the repository.
In a local version of your repo, set upFirebase Hosting using the
firebase initcommand.If you've NOT set upHosting, run this version of the commandfrom the root of your local directory:
firebase init hosting
If you've ALREADY set upHosting, then you just need to set up theGitHub Action part ofHosting. Run this version of the command fromthe root of your local directory:
firebase init hosting:github
Follow the CLI prompts, and the command will automatically take care ofsetting up the GitHub Action:
Creates a service account in your Firebase project with permission todeploy toFirebase Hosting.
Encrypts that service account's JSON key and uploads it to the specifiedGitHub repository as aGitHub secret.
Writes GitHub workflow
yamlconfiguration files that reference thenewly created secret. These files configure the GitHub Action to deploy toFirebase Hosting.
In GitHub, create a new branch and commit the workflow
yamlfiles createdby the CLI.Publish the branch to your GitHub repository.
Merge the branch.
That's it! Any subsequent PR in this GitHub repo will automatically get its own"preview URL"!
Learn more about the GitHub Action
Firebase maintains the "Deploy toFirebase Hosting" GitHub Action as anopen-source project.View the source code.
The "Deploy toFirebase Hosting" GitHub Action allows for furtherconfiguration, like customizing the expiry date for a preview channel orsetting a non-live channel to deploy to when a PR is merged.Learn about the available configuration options.
Learn more aboutGitHub Actions,in general.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2026-02-05 UTC.