diff --git a/.gitignore b/.gitignore index 71206ec..fce206f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,6 @@ # Logs logs *.log -npm-debug.log* -yarn-debug.log* -yarn-error.log* # Runtime data pids @@ -11,52 +8,8 @@ pids *.seed *.pid.lock -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# nyc test coverage -.nyc_output - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Bower dependency directory (https://bower.io/) -bower_components - -# node-waf configuration -.lock-wscript - -# Compiled binary addons (https://nodejs.org/api/addons.html) -build/Release - # Dependency directories -node_modules/ -jspm_packages/ firebase-deploy/ -# TypeScript v1 declaration files -typings/ - -# Optional npm cache directory -.npm - -# Optional eslint cache -.eslintcache - -# Optional REPL history -.node_repl_history - -# Output of 'npm pack' -*.tgz - -# Yarn Integrity file -.yarn-integrity - # dotenv environment variables file .env - -# next.js build output -.next diff --git a/README.md b/README.md new file mode 100644 index 0000000..065614c --- /dev/null +++ b/README.md @@ -0,0 +1,57 @@ +# firebase-deploy + +[CircleCI](https://circleci.com) [Orb](https://circleci.com/docs/2.0/orb-intro/#section=configuration) for deploying to [Firebase](https://firebase.google.com/) + +## Usage + +[Read the docs](https://circleci.com/orbs/registry/orb/azdevs/firebase-deploy) + +Example `.circleci/config.yaml` + +```yaml +version: 2.1 +orbs: + firebase-deploy: azdevs/firebase-deploy@1.0.0 +jobs: + build: + docker: + - image: circleci/node:lts + steps: + - checkout + - restore_cache: + key: v1-yarn-{{ checksum "yarn.lock" }} + - run: yarn install + - save_cache: + key: v1-yarn-{{ checksum "yarn.lock" }} + paths: + - ./node_modules + - run: yarn build + - persist_to_workspace: + root: /tmp/workspace + paths: + - dist + - firebase.json + - .firebaserc + - firestore.rules + - firestore.indexes.json + deploy-staging: + docker: + - image: circleci/node:lts + steps: + - attach_workspace: + at: /tmp/workspace + - firebase-deploy/deploy: + token: $FIREBASE_DEPLOY_TOKEN + alias: staging # name of an alias from your .firebaserc +workflows: + version: 2 + build-and-deploy-staging: + jobs: + - build + - deploy-staging: + requires: + - build + filters: + branches: + ignore: master +``` diff --git a/firebase-deploy.yml b/firebase-deploy.yml index 3fe96e4..bbb8bb3 100644 --- a/firebase-deploy.yml +++ b/firebase-deploy.yml @@ -1,16 +1,108 @@ version: 2.1 -description: Orb for firebase deploy. +description: Orb for deploying to Firebase. commands: deploy: - description: Deploy to firebase + description: Deploy to Firebase parameters: token: type: string description: Firebase Deploy Token + alias: + type: string + default: "default" + description: Firebase project alias to deploy to steps: - run: name: Install Firebase Tools command: npm install --prefix=./firebase-deploy firebase-tools - run: name: Deploy to Firebase - command: ./firebase-deploy/node_modules/.bin/firebase deploy --token=<< parameters.token >> + command: ./firebase-deploy/node_modules/.bin/firebase deploy --token=<< parameters.token >> -P << parameters.alias >> +examples: + default: + description: Deploying to your "default" Firebase project alias + usage: + version: 2.1 + orbs: + firebase-deploy: azdevs/firebase-deploy@1.0.0 + jobs: + build: + docker: + - image: circleci/node:lts + steps: + - checkout + - restore_cache: + key: v1-yarn-{{ checksum "yarn.lock" }} + - run: yarn install + - save_cache: + key: v1-yarn-{{ checksum "yarn.lock" }} + paths: + - ./node_modules + - run: yarn build + - persist_to_workspace: + root: /tmp/workspace + paths: + - dist + - firebase.json + - .firebaserc + - firestore.rules + - firestore.indexes.json + deploy: + docker: + - image: circleci/node:lts + steps: + - attach_workspace: + at: /tmp/workspace + - firebase-deploy/deploy: + token: $FIREBASE_DEPLOY_TOKEN + workflows: + build-and-deploy: + jobs: + - build + - deploy: + requires: + - build + alias: + description: Deploying to a custom Firebase project alias + usage: + version: 2.1 + orbs: + firebase-deploy: azdevs/firebase-deploy@1.0.0 + jobs: + build: + docker: + - image: circleci/node:lts + steps: + - checkout + - restore_cache: + key: v1-yarn-{{ checksum "yarn.lock" }} + - run: yarn install + - save_cache: + key: v1-yarn-{{ checksum "yarn.lock" }} + paths: + - ./node_modules + - run: yarn build + - persist_to_workspace: + root: /tmp/workspace + paths: + - dist + - firebase.json + - .firebaserc + - firestore.rules + - firestore.indexes.json + deploy: + docker: + - image: circleci/node:lts + steps: + - attach_workspace: + at: /tmp/workspace + - firebase-deploy/deploy: + token: $FIREBASE_DEPLOY_TOKEN + alias: staging # name of an alias from your .firebaserc + workflows: + build-and-deploy: + jobs: + - build + - deploy: + requires: + - build