# How to deploy based on some condition in travis?

**URL:** <https://travis-ci.community/t/how-to-deploy-based-on-some-condition-in-travis/12920>\
**Category:** Travis CI Discussions & Feedback\
**Tags:** build-env\
**Created:** [April 21, 2022, 6:10pm UTC](https://travis-ci.community/t/how-to-deploy-based-on-some-condition-in-travis/12920 "2022-04-21T18:10:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spineswitch](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/spineswitch/32/7693_2.png) [@Spineswitch](https://travis-ci.community/u/Spineswitch)\
**Post date:** [April 21, 2022, 6:10pm UTC](https://travis-ci.community/t/how-to-deploy-based-on-some-condition-in-travis/12920/1 "2022-04-21T18:10:12Z")

</div>

Currently, I have the travis deploy configuration like this:

```nohighlight
deploy:
  on:
    tags: true

```

But I want to add the deploy based on some condition something like this

```auto
if branch=='something'
deploy:
  on:
    tags: true

```

---

<div class="post-metadata">

**Author:** ![Montana](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/montana/32/9566_2.png) [@Montana](https://travis-ci.community/u/Montana)\
**Post date:** [April 21, 2022, 6:12pm UTC](https://travis-ci.community/t/how-to-deploy-based-on-some-condition-in-travis/12920/2 "2022-04-21T18:12:15Z")

</div>

Hey @Spineswitch,

Yeah you can use regex in this usecase in Travis, so you can do something like:

```auto
on:
  all_branches: true
  condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+

```

If you give me your whole `.travis.yml` file, I can edit it for you and make it work for you - if you think this is helpful enough that’s great too.
