DEV Community

Uriell
Uriell

Posted on

Firebase Action + Workflow for CI/CD!

My Workflow

I made firebase-function-decision-maker and firebase-lerna-typescript-boilerplate to leverage the power of GitHub Actions and make it extremely easy to deploy conditionally to Firebase!

The GitHub Action can be used in any TypeScript project to detect changes in your commits and deploy only the functions that had changes.

The Template/Boilerplate repository contains a quick start to spin up a Firebase project fully featured, with Firebase Storage & Firestore rules, Firebase Functions and Hosting. Better yet: All of it conditionally deployed based on what code changes you make!

Submission Category:

DIY Deployments

Yaml File or Link to Code

GitHub logo uriell / firebase-functions-deployment-decision

a GitHub Action that reads your diff & code to decide which functions to deploy

firebase-functions-deployment-decision

A GitHub Action that reads your TypeScript diff & code to decide which functions to deploy automagically.

How it works

After correctly configuring this action, it will start reading your file diffs and code using TypeScript's parser to map out relative file references and understand which files affected which functions.

For it to work, you should split each function as a separate file, and the file name should be similar (or the same) to your function.

Inputs

GITHUB_TOKEN
  description: 'A GitHub token to fetch the commit comparison and read file changes.'
  required: true
  example: ${{ github.token }}
INDIVIDUAL_FUNCTION_GLOB:
  description: 'A glob that matches individual function files.'
  required: true
  example: 'packages/functions/src/functions/*.ts'
FILE_CHANGES_FILTER_REGEX:
  description: 'An optional Regular Expression to filter your file changes.'
  required: false
  example: 'packages/functions/src/v2/functions'
INDIVIDUAL_FUNCTION_REGEX:
  
Enter fullscreen mode Exit fullscreen mode

GitHub logo uriell / firebase-lerna-typescript-boilerplate

Boilerplate repository for Firebase apps in a mono-repo structure using Lerna

Additional Resources / Info

In my case I have worked daily with Firebase for the past 2 years, and I knew I could make my workflow for CI/CD much better. I'm super satisfied with the results and I hope when people look for something similar they can use the Action or quick start a project with the template.

My next steps will be building & contributing to FOSS where I can apply these shiny new workflows.

Top comments (0)