# Build annotated tags only

**URL:** <https://travis-ci.community/t/build-annotated-tags-only/7785>\
**Category:** Feature Requests\
**Tags:** conditions, build-env, github-integration, travis-build\
**Created:** [March 25, 2020, 1:17pm UTC](https://travis-ci.community/t/build-annotated-tags-only/7785 "2020-03-25T13:17:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DanySK](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/danysk/32/1399_2.png) [@DanySK](https://travis-ci.community/u/DanySK)\
**Post date:** [March 25, 2020, 1:17pm UTC](https://travis-ci.community/t/build-annotated-tags-only/7785/1 "2020-03-25T13:17:28Z")

</div>

Is there any way in conditions to tell annotated tags apart from lightweight tags?

If not, I advocate the need for two further predicates besides `tag IS blank` and `tag IS present`: `tag IS lightweight` and `tag IS annotated`. Of course, both the previous would evaluate to `false` whenever there is no tag.

This could help, for instance, when deploying every commit on GitHub releases for skipping the second build triggered by the creation of a lightweight tag.

---

<div class="post-metadata">

**Author:** ![native-api](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/native-api/32/430_2.png) [@native-api](https://travis-ci.community/u/native-api)\
**Post date:** [March 25, 2020, 1:55pm UTC](https://travis-ci.community/t/build-annotated-tags-only/7785/2 "2020-03-25T13:55:56Z")

</div>

> [@DanySK](#):
>
> This could help, for instance, when deploying every commit on GitHub releases for skipping the second build triggered by the creation of a lightweight tag.

Could you be a little more specific? I don’t quite catch what you are trying to do, and any difference between the two types of tags for your purpose in particular.

AFAICS, if you are deploying every commit, you don’t need to deploy on tag builds at all – the version of the codebase that a tag has will have been deployed by the corresponding branch build.

---

<div class="post-metadata">

**Author:** ![DanySK](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/danysk/32/1399_2.png) [@DanySK](https://travis-ci.community/u/DanySK)\
**Post date:** [March 25, 2020, 4:48pm UTC](https://travis-ci.community/t/build-annotated-tags-only/7785/3 "2020-03-25T16:48:25Z")

</div>

I’ll try to clarify.  
I automatically set the version of my projects depending on the git repository status. If there is an annotated tag, then the status is considered “stable”. If there is no annotated tag, is considered “unstable”, and a lightweight tag generated with `git describe` is produced for deploying on GitHub releases.

Now, on Travis, every time i commit, and by build and deployment is successful, a second build starts for the just created lightweight tag, wasting resources. That commit has already been tested and deployed, there’s no reason to run the build again.

See, e.g., [this build](https://travis-ci.com/github/DanySK/upgradle/builds/154935168) that correctly terminated, deployed, and generated [another unwanted build](https://travis-ci.com/github/DanySK/upgradle/builds/155034788).

I am currently filtering them out with `if: type != push OR tag IS blank OR tag ~= /^\d+(\.\d+)*$/`, but that’s a kludge, what I’d like to express would be: `if: type != push OR tag IS blank OR tag IS lightweight`, this way I could create releases with arbitrary names.  
Also, the build config would be more readable.

Let me know if I made myself clearer 🙂

Cheers
