Automagically Deploy Gastby Site with GitHub Actions

 2023-11-16 1 minute read 0 Comments #firebase | #gatsby | #promptfu | #web

After setting up your Gatsby website and manually deploying it to Firebase as detailed in our previous guide, it’s time to streamline your deployment process. This article will guide you through the steps to set up automatic deployment to Firebase Hosting using GitHub Actions.

May your deploys be smooth, and your build errors few. Keep automating and innovating!


  • A Gatsby website as detailed in Part 1
  • GitHub repository for your Gatsby project
  • Firebase project set up and configured

Setting Up Firebase Hosting with GitHub

  1. Initialize Firebase Hosting for GitHub: In your project directory, run:

    firebase init hosting:github

    Ref: Set up the GitHub Action to deploy to Firebase Hosting

  2. Automated Setup: The command will prompt you through setting up GitHub Actions, which includes:

    • Creating a service account in Firebase with deployment permissions.
    • Encrypting and uploading the service account’s JSON key to your GitHub repository as a secret.
    • Writing GitHub workflow YAML configuration files to deploy to Firebase Hosting.
  3. Commit and Push: Create a new branch, commit the workflow files, and push to GitHub.

  4. Merge to Main: Merge the branch to your main branch.


With these steps, every push to your main branch will trigger an automatic build and deployment of your Gatsby site to Firebase Hosting. This setup not only saves time, it also ensures consistency in your deployment process. Now, you can focus more on development and less on manual deployment tasks.

 Categories: #web

Ready for another?
Deploy Your Gatsby Website to Firebase (by Google)

Discover how to host your Gatsby website on Firebase (by Google) with this step-by-step guide. This tutorial covers everything from site creation and building to Firebase setup and deployment, ensuring a seamless hosting process.

To Infinity and Beyond Code!

Tech tips and command line fu found within this dojo