Skip to content

Instantly share code, notes, and snippets.

@vlaja
Last active July 11, 2024 23:48
Show Gist options
  • Save vlaja/7a024b75c9412ad32eb40c6b5d2e04a3 to your computer and use it in GitHub Desktop.
Save vlaja/7a024b75c9412ad32eb40c6b5d2e04a3 to your computer and use it in GitHub Desktop.
Firebase multi-site deployment config for CircleCI
version: 2.1
executors:
node10:
docker:
- image: circleci/node:10
working_directory: ~/project
commands:
build:
description: "Builds the project"
steps:
- checkout
- restore_cache:
keys:
# Find a yarn.lock cache
- v1-npm-deps-{{ checksum "yarn.lock" }}
# Fallback cache to be used
- v1-npm-deps-
- run:
name: Install Dependencies
command: yarn install
- save_cache:
key: v1-npm-deps-{{ checksum "yarn.lock" }}
paths:
- ./node_modules
- run:
name: Build for current environment.
command: yarn build
deploy:
description: "Deploy project to the designated environment"
parameters:
env:
type: string
default: "test"
steps:
- run:
name: Firebase Deploy
command: ./node_modules/.bin/firebase deploy --token "$FIREBASE_TOKEN" --non-interactive --only hosting:<< parameters.env >>
jobs:
build-deploy-test:
executor: node10
steps:
- build
- deploy:
env: "test"
build-deploy-staging:
executor: node10
steps:
- build
- deploy:
env: "staging"
build-deploy-production:
executor: node10
steps:
- build
- deploy:
env: "production"
workflows:
version: 2
test:
jobs:
- build-deploy-test:
filters:
branches:
only: develop
staging:
jobs:
- build-deploy-staging:
filters:
branches:
only: /release\/.*/
production:
jobs:
- build-deploy-production:
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment