When we cut release branches for our product, we version them like this:
release/x.x.x
Is there a way on travis.yml file to set deploy on branch matching a regex pattern?
travis.yml snippet:
provider: script
script: bash dockerbuildandpush.sh
on:
branch: /^release\/.*$/
The above-mentioned snippet does not work. Any help would be appreciated.
Figured it out. Leaving it out there for anyone else trying to do the same thing.
provider: script
script: bash dockerbuildandpush.sh
on:
all_branches: true
condition: ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} =~ ^release\/.*$
Explanation for ${TRAVIS_PULL_REQUEST_BRANCH:-$TRAVIS_BRANCH} can be found here:
https://github.com/travis-ci/travis-ci/issues/6652
https://graysonkoonce.com/getting-the-current-branch-name-during-a-pull-request-in-travis-ci/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With