Backing up Firebase project with Github Actions
Backups are really useless most of the time… until something goes wrong and you really need one.
This article will help provide some easy to apply recipes to back up your Firebase project, in a single Github Action workflow.
To implement this workflow you will be needing
- Firebase token for CI/CD deployment.
- Service account that can access your Firebase project and storage buckets.
We will be making a snapshot backup that is being replaced for each run and another accumulative one that is adding every new backup into an historical archive.
Make sure that your GCP project has a “backups bucket”. It should be listed in your Google Cloud Platform Console, but not in the Firebase console. Replace
example in the URL below to check and confirm.
If your project ID is
example, then you should have a bucket called
The bucket is automatically created if you have already configured Firebase Database automated backups before. You can configure to switch them on right away to get two-for-one: both having the bucket generated and benefits of automated backups.
We will be using this bucket to store our own backups too.
The schedule for your snapshot backups is up to you on how frequent you find it necessary. In this example we’re making a nightly snapshot of the project.
The schedule for your archive backups is also up to your own needs, depending on how frequent you find it necessary. In this example we’re making a monthly backup archive of the project.
Sleep well knowing that your project is backed up on a regular basis.