diff --git a/.circleci/config.yml b/.circleci/config.yml index 7b46c389..864b7855 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,6 +1,6 @@ version: 2 jobs: - build: + config: docker: - image: circleci/node:8.9 @@ -14,11 +14,82 @@ jobs: - v1-dependencies- - run: yarn install - - save_cache: paths: - node_modules key: v1-dependencies-{{ checksum "package.json" }} + build: + docker: + - image: circleci/node:8.9 + + working_directory: ~/repo + + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - v1-dependencies- + + - run: + name: Building project + command: yarn build + - persist_to_workspace: + root: ~/repo + paths: . + + test: + docker: + - image: circleci/node:8.9 + + working_directory: ~/repo + + steps: + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + - v1-dependencies- + - run: + name: Lint + command: yarn lint + - run: + name: Testing + command: yarn test + deploy: + docker: + - image: circleci/node:8.9 + + working_directory: ~/repo + steps: + - attach_workspace: + at: ~/repo + - run: + name: Authenticate with registry + command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc + - run: + name: Publish package + command: npm publish - - run: yarn lint - - run: yarn test +workflows: + version: 2 + build_test_deploy: + jobs: + - config + - build: + requires: + - config + - test: + requires: + - config + filters: + tags: + ignore: /.*/ + - deploy: + requires: + - build + filters: + tags: + only: /.*/ + branches: + ignore: /.*/