2017-07-08 05:59:11 +03:00
|
|
|
#!/bin/bash
|
2017-07-08 01:57:33 +03:00
|
|
|
set -e
|
2017-07-08 02:00:22 +03:00
|
|
|
|
2017-07-12 23:43:31 +03:00
|
|
|
# --yes gets passed in by .travis.yml,
|
|
|
|
# which makes this easier to test locally
|
2017-07-21 00:13:49 +03:00
|
|
|
args=$@
|
2017-07-11 01:48:41 +03:00
|
|
|
|
2017-07-25 20:23:41 +03:00
|
|
|
branch=$TRAVIS_BRANCH
|
2017-07-21 02:49:22 +03:00
|
|
|
|
2017-07-25 23:44:50 +03:00
|
|
|
# the presence of $TRAVIS_PULL_REQUEST_BRANCH tells us
|
|
|
|
# whether this is a pull request
|
|
|
|
if [[ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]]; then
|
2017-07-25 20:23:41 +03:00
|
|
|
target_branch=$TRAVIS_PULL_REQUEST_BRANCH
|
2017-07-25 20:32:15 +03:00
|
|
|
# if the *source* branch begins with "release"
|
|
|
|
if [[ "$branch" =~ ^release ]]; then
|
2017-07-21 03:02:11 +03:00
|
|
|
script/release-candidate $args
|
2017-07-25 20:32:15 +03:00
|
|
|
# otherwise, if the *target* branch is dev
|
2017-07-25 20:23:41 +03:00
|
|
|
elif [[ "$target_branch" = "dev" ]]; then
|
|
|
|
script/release-pr $args
|
2017-07-25 20:32:15 +03:00
|
|
|
else
|
|
|
|
echo "⚠️ This is a PR, but '$branch' isn't a release branch"
|
|
|
|
echo " and '$target_branch' isn't a recognized target branch."
|
|
|
|
exit 1
|
2017-07-21 03:02:11 +03:00
|
|
|
fi
|
2017-07-21 03:08:47 +03:00
|
|
|
elif [[ "$branch" = "master" ]]; then
|
2017-07-21 01:21:59 +03:00
|
|
|
script/release $args
|
2017-07-08 01:57:33 +03:00
|
|
|
else
|
2017-07-21 03:08:47 +03:00
|
|
|
echo "⚠️ This isn't a PR and '$branch' isn't a release branch."
|
2017-07-08 01:57:33 +03:00
|
|
|
exit 1
|
|
|
|
fi
|
2017-07-25 20:32:15 +03:00
|
|
|
|