Kyle Pericak

"It works in my environment."

Thu 16 January 2020

CircleCI: Continuous Delivery for Firebase

Posted by Kyle Pericak in development   

Create CI token

This will do the usual browser-based login system, so if you're using a VM then be sure your lolcahost:9005 goes to the server's :9005.

firebase login:ci

Add token as CircleCI env var

  1. Log into CircleCI
  2. Choose your GitHub project
  3. Use the Hello World build template
  4. Assign that token as $FIREBASE_DEPLOY_TOKEN in the project's environment variable settings.
    1. Navigate to your project in CircleCI
    2. Click the gear on the top-right to open this project's settings
    3. Open environment variables page
    4. Add Variable. Name: FIREBASE_DEPLOY_TOKEN, value is your token.
    5. Add another variable for FIREBASE_PROJECT and set it to your Firebase project's name.

Write .circleci/config.yml

I found this guide useful.

Example File

version: 2
      # Using latest can cause failures, but I hope it will help me keep up
      - image: circleci/node:latest
      - checkout
      - run: npm install --prefix=./firebase-deploy firebase-tools
      - run: >
          ./firebase-deploy/node_modules/.bin/firebase deploy

Locally validating your config

You can use CircleCI's local-ci. Note that this was tested on a dev Ubuntu server.

Install - official docs

snap install docker circleci
snap connect circleci:docker docker

Test your configuration file. Navigate to your project directory first.

circleci config validate
# or
circleci config validate <config file path>

Javascript appears to be disabled. Comments can't load.