Struggling to get the right custom condition to get pypi deployment running

Even after reading the docs and checking examples, I still don’t know what I’m doing wrong:

  • I have a pypi deployment
  • it has the condition condition: $MAKE_STEP =~ ^(bdist_wheel|sdist|bdist_win)$ && tag =~ ^v[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9])?\.dev[0-9]$
  • the tag is there and is v1.9.0b1.dev4
  • so I would expect at least sdist (the last job in the example) to deploy to PyPI
  • I only get Skipping a deployment with the pypi provider because a custom condition was not met
  • the condition without the && tag ... works as expected so the 2nd condition seems wrong but I don’t get what’s wrong
  • I’m slightly confused by the condition documentation which states that env(MAKE_STEP) should be used and not $MAKE_STEP but it works for me (without the 2nd condition at least)

Any help welcome,
Eric

Example: https://travis-ci.org/rdiff-backup/rdiff-backup/builds/647642574

Changing the condition to condition: env(MAKE_STEP) IN (bdist_wheel, sdist, bdist_win) AND tag =~ /^v[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9])?\.dev[0-9]$/ doesn’t help and even leads to a parsing error:

/home/travis/.travis/job_stages: line 871: unexpected token `(', conditional binary operator expected
/home/travis/.travis/job_stages: line 871: expected `)'
/home/travis/.travis/job_stages: line 871: syntax error near `(env(M'
/home/travis/.travis/job_stages: line 871: `  if [[ (env(MAKE_STEP) IN (bdist_wheel, sdist, bdist_win) AND tag =~ /^v[0-9]+\.[0-9]+\.[0-9]+((a|b|rc)[0-9])?\.dev[0-9]$/) && ("$TRAVIS_TAG" != "") ]]; then'

It looks like I completely misunderstood which syntax applies. I was looking at https://docs.travis-ci.com/user/conditions-v1 but it seems not to be the right source… I’m definitely confused…

It looks like the solution was to replace tag with $TRAVIS_TAG but I don’t understand in which parallel universe compared to the documentation I landed.

on: conditions for deployments don’t use the conditions library and are instead described at https://docs.travis-ci.com/user/deployment#conditional-releases-with-on.

As it says, the syntax in on: condition: is a Bash condition where “tag” is not a keyword.

Imprint