How can I deploy a ClojureScript web app to Google Firebase with GitHub Actions?
Software Engineering Team Lead and Director of Cloudsure
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.
-
Install (or upgrade) the firebase-tools. I am running
9.23.0
.npm install -g firebase-tools
-
Install firebase in your project.
npm install firebase@9.5.0 --save
-
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.
firebase init
-
Option 2: Set up using the Hosting command.
# 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
-
Follow the prompts
-
Create a new or use an existing Firebase project.
-
Creates a service account in your Firebase project with permission to deploy to Firebase Hosting.
-
Encrypts that service account's JSON key and uploads it to the specified GitHub repository as a GitHub secret.
-
Writes GitHub workflow
yaml
configuration files that reference the newly created secret.These files configure the GitHub Action to deploy to Firebase Hosting.
-
Check the console output for links to your project and GitHub.
-
If you experience any errors, read the
firebase-debug.log
.
-
-
Create a new branch and commit the workflow yaml files created by the CLI.
-
Publish the branch to your GitHub repository.
-
We will merge the branch later.