Circleci: How to deploy depending on git release(release a tag)

1.1k Views Asked by At

Is there a way to restrict circleci deployment on checkings that have a git release(release a tag)

1

There are 1 best solutions below

0
On BEST ANSWER

I think there are several ways to achieve what you want.

With this example you can run a specific deployment only when the tag matches some regex.

workflows:
  my-deploy-workflow:
    jobs:
      - deploy-my-app:
          filters:
            tags:
              only: <put some regex here>

Another option is to use the actual tag, which you can access through pipeline parameters: << pipeline.git.tag >> (link to docs: https://circleci.com/docs/2.0/pipeline-variables/)

Here, you can use the following construct to test for equality:

workflows:
  my-deploy-workflow:
    when:
      and:
        - equal: [something, << pipeline.git.tag >>]
    jobs:
      - deploy-my-app

Additionally, you could also use the filtering options at the job level, instead of the workflow level.