Reputation: 855
I have specified multiple deploy script providers. One which is expected to run, but skipped is:
- provider: script
skip_cleanup: true
script: curl -sL https://git.io/goreleaser | bash -s -- --rm-dist --skip-publish
verbose: true
on:
condition: "$TRAVIS_OS_NAME = linux"
branches:
only:
- /^release\/.*$/
go: 1.11.x
Last three deploys are only on master branch, so its right to skip them.
The first deploy which is on all branches matching regexp: /^release/.*$/ should run for this branch release/2.1.5. However it’s skipping this deploy too.
Can someone point why the release branch deploy is skipped in this case? I want the first deploy to run on linux and release branches only like: release/2.1.5.
Travis build: https://travis-ci.org/leopardslab/dunner/jobs/560593148
Travis Config file: https://github.com/leopardslab/dunner/blob/172a4c5792b0a8389556cc8ee4f690dc73fafb6e/.travis.yml
Upvotes: 0
Views: 1041
Reputation: 855
To run the deploy script conditionally, say only on branches matching a regular expression like release branches as ^release\/.*$
, use condition field and concatenate multiple conditions using &&. The branch
or branches
field does not support regexp.
If branch
or branches
field is not specified, travis assumes its on master branch(or default branch). So be sure to include all_branches: true
line in travis config.
You can access current branch name using travis env variable $TRAVIS_BRANCH
.
deploy:
- provider: script
script: bash myscript.sh
verbose: true
on:
all_branches: true
condition: $TRAVIS_BRANCH =~ ^release\/.*$ && $TRAVIS_OS_NAME = linux
Upvotes: 1