From e0ab5995d6b6da1bb4ebd6a61f9e0fe755597587 Mon Sep 17 00:00:00 2001 From: Eug-VS Date: Mon, 3 Feb 2020 22:53:42 +0300 Subject: ci: update configuration --- .circleci/config.yml | 54 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 14 deletions(-) (limited to '.circleci/config.yml') 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 + -- cgit v1.2.3