diff options
Diffstat (limited to '.circleci/config.yml')
-rw-r--r-- | .circleci/config.yml | 58 |
1 files changed, 51 insertions, 7 deletions
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 + |