Continuous integration/deployment
We use GitHub Actions for our CI/CD. It consists of workflows written in a .yml file similar to other CI/CD tools like travis, jenkins, etc.
Each workflow is triggered by events like push, commits and other GitHub API events.

Workflows folder structure

1
.github/
2
└── workflows/
3
├── production-deployment.yml
4
├── pull-requests.yml
5
└── staging-deployment.yml
Copied!

Active workflows in the project

  • Pull requests: gets triggered on pull request of branches: master, feature/* and development. It builds and runs the tests of the React frontend.
  • Staging deployment: gets triggered on commits in the development branch. It builds the React frontend and deploys: hosting, functions and DB rules.
  • Production deployment: gets triggered on commits in the master branch. It builds the React frontend and deploys: hosting, functions and DB rules.

Setting up GitHub Actions in your repo

To get the workflows we mentioned previously up and running, you'll need to have two Firebase Projects, one will be your production environment and the other one your staging environment.
You will need to set up your environment variables as GitHub Secrets, both for your staging and production projects.
Also, you'll need to set up your FIREBASE_TOKEN secret. You get this token by logging in using the command firebase login:ci in your terminal. More info on this Firebase login CI.
After setting up all your github secrets, they should look like this:
Github Secrets

Writing new workflows

You can refer to this on the GitHub Actions documentations.
Last modified 1yr ago