diff options
Diffstat (limited to '.circleci/config.yml')
-rw-r--r-- | .circleci/config.yml | 54 |
1 files changed, 40 insertions, 14 deletions
diff --git a/.circleci/config.yml b/.circleci/config.yml index 30202f5..84c6a35 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,11 +1,13 @@ version: 2 -jobs: - build: - docker: - - image: circleci/node:12-stretch - working_directory: ~/repo +defaults: &defaults + working_directory: ~/repo + docker: + - image: circleci/node:12-stretch +jobs: + checkout_and_test: + <<: *defaults steps: - checkout - restore_cache: @@ -28,16 +30,15 @@ jobs: command: npm test deploy: - docker: - - image: circleci/node:12-stretch - requires: - - build - filters: - tags: - only: /^v.*/ + <<: *defaults steps: - - attach_workspace: - at: ~/repo + - checkout + - restore_cache: + keys: + - v1-dependencies-{{ checksum "package.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + - run: name: Authenticate with registry command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/repo/.npmrc @@ -45,3 +46,28 @@ jobs: name: Deploy package command: npm run deploy + +workflows: + version: 2 + + test: + jobs: + - checkout_and_test + + deploy: + jobs: + - checkout_and_test: + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + - deploy: + filters: + branches: + ignore: /.*/ + tags: + only: /^v.*/ + requires: + - checkout_and_test + |