Skip to content

Instantly share code, notes, and snippets.

@Mr-Perfection
Last active March 23, 2018 03:07
Show Gist options
  • Save Mr-Perfection/2cb7558db9b32a6f4f7438ebca3b93fd to your computer and use it in GitHub Desktop.
Save Mr-Perfection/2cb7558db9b32a6f4f7438ebca3b93fd to your computer and use it in GitHub Desktop.
version: 2
jobs:
build:
working_directory: ~/firebase-functions-hello-world
docker:
# specify the version you desire here
- image: circleci/node:7.10
steps:
- checkout
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: Install npm dependencies inside functions...
command: npm install -prefix "functions"
- save_cache:
paths:
- ~/firebase-functions-hello-world
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
deploy-dev:
docker:
- image: circleci/node:7.10
working_directory: ~/firebase-functions-hello-world
steps:
- run: |
echo Deploying to firebase...
firebase use --token ${FIREBASE_DEPLOY_TOKEN} ${PROJECT_ID}
firebase deploy --token ${FIREBASE_DEPLOY_TOKEN}
deploy-prod:
docker:
- image: circleci/node:7.10
working_directory: ~/firebase-functions-hello-world
steps:
- run:
name: Install firebase-tools...
command: sudo npm install -g firebase-tools
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run: |
echo Deploying to firebase...
firebase use --token ${FIREBASE_DEPLOY_TOKEN} ${PROJECT_ID}
firebase deploy --token ${FIREBASE_DEPLOY_TOKEN}
workflows:
version: 2
build-deploy:
jobs:
- build
- deploy-dev:
requires:
- build
filters:
branches:
only: /dev-.*/
- deploy-prod:
requires:
- build
filters:
branches:
only: master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment