The conditional in the YAML example for Travis-CI doesn't actually work.
if: branch = master AND tag IS PRESENT AND repo = joerick/cibuildwheel
Travis-CI jobs triggered by a tag do not have the branch name available. Instead they use the tag name for branch. This means you can't have a conditional that matches on both branch and tag variables.
See: https://stackoverflow.com/questions/54929914/travis-deploy-stage-not-running-with-condition-if-branch-master-and-tag-is-pr
Recommend switching to a different example such as:
# Only execute deployment stage on tagged release commits in the form of "v1.2.3"
# and from your repository (e.g. not PRs).
- name: deploy
if: repo = joerick/cibuildwheel AND tag =~ ^v\d+\.\d+\.\d+$
Thanks for raising this issue! This example was added in #228, I believe, so, @SethMMorton: was there a reason you did it like this, or ...?
Also, @amykyta3, you did git push --tags, right? Because when I make a release, that commits somehow always gets built twice by Travis CI (once for the commit and once for the tag).
Honest mistake. It should be if: (branch = master OR tag IS PRESENT) AND repo = joerick/cibuildwheel. Sorry about that.
You could switch to the regex version too if you want.
Damn it! Another honest mistake. I should not respond to messages first thing in the morning.
if: (branch = master OR tag IS PRESENT) AND repo = joerick/cibuildwheel would run more than you like, obviously. I use this in my repos because I deploy to test PyPI on non-tagged commits, but that's not what is set up in this example if I remember correctly.
If one only tags on release, then if: tag IS PRESENT AND repo = joerick/cibuildwheel would be fine. But if one tags for other reasons as well, then the regex version is probably the way to go. However, if going that route one should consider that the regex may not cover all versioning schemes, so users should note that they may have to modify it to fit their needs.
No problem!
Experimenting with my first bdist deployments and this is an awesome tool! Thanks for the amazing work!
For completeness, here is an example of a tag-triggered build that uses the old query where I was experimenting on my travis branch:
https://travis-ci.org/SystemRDL/systemrdl-compiler/builds/637795799/config
@SethMMorton Thanks for the quick reply! :-)
Does that work for you, @amykyta3? I kind of prefer the non-regexy version, as this is better readable. And I think it's more general, no, since it doesn't need tags to have a certain form?
(@joerick This makes me even more convinced we should test the example configurations somehow, but ... pfff, no clue how to do this.)
Agree. For an example, non-regex is probably simpler
Agree. For an example, non-regex is probably simpler
Right. Let's add your line as a comment, then!
But if: tag IS PRESENT AND repo = joerick/cibuildwheel works for you? If you can confirm that, I'll fix the docs :-)
But if: tag IS PRESENT AND repo = joerick/cibuildwheel works for you?
Yep!
Coming clean :-), Didn't actually confirm on my side, but found multiple other projects that use this pattern and see that their deployments do indeed work.
https://github.com/search?q=%22tag+is+present+and+repo%22&type=Code
Which means that the main problem was that your tag wasn't on master?
Nah. When I was testing, I changed my query to match the branch I was testing on (see config in https://travis-ci.org/SystemRDL/systemrdl-compiler/builds/637795799/config)
(Btw, @SethMMorton, I don't know if you've followed this, but thanks to you, we now have all examples of the docs nicely in the examples/ directory; so thanks for that idea :-) )
Awesome! Glad I could help!
Most helpful comment
Honest mistake. It should be
if: (branch = master OR tag IS PRESENT) AND repo = joerick/cibuildwheel. Sorry about that.You could switch to the regex version too if you want.