Support on: attribute for stages

Declaring custom deploy stage with on: attribute doesn’t throw any errors and doesn’t process it correctly. In the example below stage: deploy is being executed regardless of if the commit is a tag or not.

jobs:
  include:
    - stage: deploy
      script:
        - python pypack.py pypack.py
        - twine upload *.zip
      on:
        tags: true

Full config and build result - https://travis-ci.org/techtonik/pypack/jobs/578377428/config

There are filter for stages, but if not supporting on: for consistency with deploy: there could be at least an error on on: with stage: to point to the right direction.

jobs:
  include:
    - stage: deploy
      script:
        - python pypack.py pypack.py
        - twine upload *.zip
      if: tag IS present

should achieve what you want.

See https://docs.travis-ci.com/user/conditional-builds-stages-jobs/ and https://docs.travis-ci.com/user/conditions-v1

1 Like

I had to translate code from deploy: method, because pypi provider tries to execute setup.py, which could be absent in new packages. And I was surprised that conditions for deploy step are not consistent in syntax for conditions for stages.

https://docs.travis-ci.com/user/deployment/#conditional-releases-with-on

I finally found the syntax, but all these back and forth are spending really a lot more time than necessary for a simple CI config.

Imprint