version: 2

jobs:
  build:
    docker:
      - image: circleci/node:latest
    steps:
      - checkout
      
      # - run:
      #     name: update-npm
      #     command: 'sudo npm install -g npm@latest'
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: install-npm-wee
          command: npm install
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - ./node_modules
      - run:
          name: test
          command: npm test
      - run:
          name: deploy
          command: |
            echo "${CIRCLE_TAG}"
            if [[ "${CIRCLE_TAG}" =~ v[0-9]+(\.[0-9]+)* ]]; then
              node ./scripts/publish.js
            fi
version: 2

jobs:
  build:
    docker:
      - image: circleci/node:latest
    steps:
      - checkout
      # - run:
      #     name: update-npm
      #     command: 'sudo npm install -g npm@latest'
      - restore_cache:
          key: dependency-cache-{{ checksum "package.json" }}
      - run:
          name: install-npm-wee
          command: npm install
      - save_cache:
          key: dependency-cache-{{ checksum "package.json" }}
          paths:
            - ./node_modules
      - run:
          name: test
          command: npm test
      - run:
          name: deploy
          command: |
            echo "${CIRCLE_TAG}"
            if [[ "${CIRCLE_TAG}" =~ v[0-9]+(\.[0-9]+)* ]]; then
              node ./scripts/publish.js
            fi

workflows:
  version: 2
  build-n-publish:
    jobs:
      - build:
          filters:
            tags:
              only: /v[0-9]+(\.[0-9]+)*/
Add workflow to trigger tag builds
Add workflow to trigger tag builds
