Stage with "on: tags: true" runs when no tag for the current commit

I have a deploy stage set up like:

  [other stages]
  - stage: deploy
      tags: true
    provider: script
    - "./.travis/docker_push.bash"
    skip_cleanup: true

This stage was running on commits that didn’t have a tag created by the previous stage. You can see on the link that I changed to using the $TRAVIS_TAG env variable, but it fails. What am I misunderstanding here?

on: is only valid for, and located under, the deploy: clause. And it only sets a condition for a specific deployment in the deploy phase, not for the entire job.

If you need to run an entire job conditionally, use if: as per Conditional Builds, Stages and Jobs - Travis CI.

The condition to define a stage is explained in

What you need is:

  - stage: deploy
    if: tag IS present
    # ⋮

Thank you very much, I was carrying this bit from another CI yaml and assumed it worked the same way.