version: 2.0 jobs: build: docker: - image: node:8 environment: COVERALLS_SERVICE_JOB_ID: $CIRCLE_BUILD_NUM COVERALLS_GIT_COMMIT: $CIRLE_SHA1 COVERALLS_PARALLEL: true steps: - checkout - run: echo $CIRCLE_SHA1 > .circle-sha - run: echo "Install Dependencies" - run: npm i - run: npm i -C www - run: echo "Run Tests" - run: npm test - run: if [ $CIRCLE_BRANCH = 'master' ]; then npm run coverage; fi - run: echo "Build" - run: npm run build - save_cache: key: project-{{ checksum ".circle-sha" }} paths: - ~/project deploy: docker: - image: node:8 steps: - run: echo $CIRCLE_SHA1 > .circle-sha - restore_cache: keys: - project-{{ checksum ".circle-sha" }} - run: command: | echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > ~/.npmrc npm publish dist npm run deploy-docs deploy-docs: docker: - image: node:8 steps: - run: echo $CIRCLE_SHA1 > .circle-sha - restore_cache: keys: - project-{{ checksum ".circle-sha" }} - run: command: | npm run deploy-docs workflows: version: 2 build_and_deploy: jobs: - build: filters: tags: only: /.*/ - deploy: requires: - build filters: branches: ignore: /.*/ tags: only: /\d+(\.\d+){2}(-(alpha|beta)(\d+)?)?/ - deploy-docs: requires: - deploy filters: branches: ignore: /.*/ tags: only: /\d+(\.\d+){2}/