My deploy job always runs, ignoring my tag filter


I have the following in my config.yml file. When I kick off a build, the deploy job always runs, but I only want it to run on tag commits which match the regex in my filter. Any help is appreciated!

  version: 2
        - build
        - test:
              - build
        - deploy:
              - test
                only: /[0-9]+\.[0-9]+\.[0-9]+/


Note that the logic should be:

  • If a tag commit is pushed, run build, then test, then deploy
  • If a non-tag commit is pushed, run build then test


Possible duplicates or related:


Thank you for the response, however those issues aren’t quite the same as what I’m seeing. As it turns out, I am actually familiar with that problem, it’s a issue with TravisCI as well. If CircleCI operates similarly, then there’s no real solution - Travis checks outs tag which puts the local repo in
a headless state i.e. it’s not tied to a specific branch. The best you can do is run git branch --contains I found that that approach wasn’t 100% reliable either.

Regarding my issue, I want to run the deploy job if and only if, a tag commit has been pushed and I want it to run sequentially after the test job which should run after the build job.

In other words:

  1. The build job always runs.
  2. The test job always runs, unless the build job fails.
  3. The deploy job runs only for tag commits and only if build and test both succeed.

It seems like I should be able to make that flow work somehow in my config.yml file.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.