I have following circleci. The problem is that npm_publish job is executed no matter what tag is set and it should be executed only on tag matching regex(regex /v[0-9]+(.[0-9]+)*/)
What I'm doing wrong?
version: 2
jobs:
build_and_test:
docker:
- image: circleci/node:7.10
working_directory: ~/checkout-dir
steps:
- checkout
- run: yarn install
- run: npm run build
- run: npm test
- save_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
paths:
- ~/checkout-dir
npm_publish:
docker:
- image: circleci/node:7.10
working_directory: ~/checkout-dir
steps:
- restore_cache:
key: v1-repo-{{ .Environment.CIRCLE_SHA1 }}
- run:
name: setup npm
command: |
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
- run: npm publish
workflows:
version: 2
build:
jobs:
- build_and_test
build_and_deploy:
jobs:
- build_and_test:
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
only: master
- npm_publish:
requires:
- build_and_test
filters:
tags:
only: /v[0-9]+(\.[0-9]+)*/
branches:
only: master