Baking cookies
Gradient background

How can I deploy a ClojureScript web app to Google Firebase with GitHub Actions?

Clarice Bouwer

Software Engineering Team Lead and Director of Cloudsure

Monday, 22 November 2021 · Estimated 1 minute read

The goal of this guide is to show you how to deploy a ClojureScript web app to Google Firebase Hosting with GitHub Action deploys.

There are a few assumptions and they are that you are already familiar with the basics of

This guide is based on the ClojureScript + Tailwind [template][cljs-app-with-tailwindcss] from the previous guide which is hosted as a template on GitHub if would like to follow along.

Setup your Firebase instance

I am on the Spark plan, which is free.

Follow the official guide to set up the GitHub Action to deploy to Firebase Hosting.

  1. Install (or upgrade) the firebase-tools. I am running 9.23.0.

    Copy
    npm install -g firebase-tools
  2. Install firebase in your project.

    Copy
    npm install firebase@9.5.0 --save
  3. Option 1: Initialize your Firebase project and select Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys go through the prompts and voila.

    Copy
    firebase init
  4. Option 2: Set up using the Hosting command.

    Copy
    # If you have NOT set up Hosting yet, do so now.
    firebase init hosting
    
    # If you have ALREADY set up Hosting, configure
    # GitHub Actions directly.
    firebase init hosting:github
  5. Follow the prompts

    1. Create a new or use an existing Firebase project.

    2. Creates a service account in your Firebase project with permission to deploy to Firebase Hosting.

    3. Encrypts that service account's JSON key and uploads it to the specified GitHub repository as a GitHub secret.

    4. Writes GitHub workflow yaml configuration files that reference the newly created secret.

      These files configure the GitHub Action to deploy to Firebase Hosting.

    5. Check the console output for links to your project and GitHub.

    6. If you experience any errors, read the firebase-debug.log.

  6. Create a new branch and commit the workflow yaml files created by the CLI.

  7. Publish the branch to your GitHub repository.

  8. We will merge the branch later.