1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 01:04:04 +03:00
css/script/cibuild
2017-07-25 13:55:53 -07:00

39 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
set -e
# --yes gets passed in by .travis.yml,
# which makes this easier to test locally
args=$@
branch=$TRAVIS_BRANCH
echo "🐛 script/cibuild"
(
echo "TRAVIS_BRANCH,$TRAVIS_BRANCH"
echo "TRAVIS_PULL_REQUEST,$TRAVIS_PULL_REQUEST"
echo "TRAVIS_PULL_REQUEST_BRANCH,$TRAVIS_PULL_REQUEST_BRANCH"
) | column -t -s=,
# the presence of $TRAVIS_PULL_REQUEST_BRANCH tells us
# whether this is a pull request
if [[ "$TRAVIS_PULL_REQUEST_BRANCH" != "" ]]; then
target_branch=$TRAVIS_PULL_REQUEST_BRANCH
# if the *source* branch begins with "release"
if [[ "$branch" =~ ^release ]]; then
script/release-candidate $args
# otherwise, if the *target* branch is dev
elif [[ "$target_branch" = "dev" ]]; then
script/release-pr $args
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
fi
elif [[ "$branch" = "master" ]]; then
script/release $args
else
echo "⚠️ This isn't a PR and '$branch' isn't a release branch."
exit 1
fi