From e894e21956d8cfd0045125581f04291639d781ae Mon Sep 17 00:00:00 2001 From: eug-vs Date: Sat, 21 Mar 2020 18:06:17 +0300 Subject: ci: add deploy rule :rocket: --- .circleci/config.yml | 58 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 51 insertions(+), 7 deletions(-) (limited to '.circleci/config.yml') diff --git a/.circleci/config.yml b/.circleci/config.yml index fef5ed0..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: @@ -15,7 +17,7 @@ jobs: - v1-dependencies- - run: - name: install NPM dependencies + name: Install NPM dependencies command: npm install - save_cache: @@ -24,6 +26,48 @@ jobs: key: v1-dependencies-{{ checksum "package.json" }} - run: - name: Check types and lint code + name: Test syntax and perform type checking command: npm test + deploy: + <<: *defaults + steps: + - 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 + - run: + 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