# Regex to build and deploy when any tag is pushed

**URL:** <https://discuss.circleci.com/t/regex-to-build-and-deploy-when-any-tag-is-pushed/4114>\
**Category:** Deployments\
**Created:** [May 20, 2016, 10:57am UTC](https://discuss.circleci.com/t/regex-to-build-and-deploy-when-any-tag-is-pushed/4114 "2016-05-20T10:57:16Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tom](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/tom/32/27680_2.png) [@tom](https://discuss.circleci.com/u/tom)\
**Post date:** [May 20, 2016, 10:57am UTC](https://discuss.circleci.com/t/regex-to-build-and-deploy-when-any-tag-is-pushed/4114/1 "2016-05-20T10:57:16Z")

</div>

As per [our docs](https://circleci.com/docs/configuration/#tags) you can add settings `circle.yml` to build and deploy your project when you push a tag / release.

If you wan to build whenever any tag is pushed, you need to use the following regex:

`/.*?/`

(`/.*/` won’t work)

So your deploy section would like something like this:

```auto
deployment:
  release:
    tag: /.*?/
    owner: foo
    commands:
      - "true"

```

The final “true” statement is just a way to test before you put in the real deployment commands/

---

<div class="post-metadata">

**Author:** ![jakajancar](https://sea2.discourse-cdn.com/circleci/user_avatar/discuss.circleci.com/jakajancar/32/2233_2.png) [@jakajancar](https://discuss.circleci.com/u/jakajancar)\
**Post date:** [May 24, 2016, 4:35am UTC](https://discuss.circleci.com/t/regex-to-build-and-deploy-when-any-tag-is-pushed/4114/2 "2016-05-24T04:35:36Z")

</div>

Out of curiosity, how come greedy matches don’t work?

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/circleci/original/3X/5/1/511608acda8e85906e15909b57bd0a46c1dbe291.png) [@system](https://discuss.circleci.com/u/system)\
**Post date:** [June 18, 2018, 11:41am UTC](https://discuss.circleci.com/t/regex-to-build-and-deploy-when-any-tag-is-pushed/4114/3 "2018-06-18T11:41:02Z")

</div>


