1
1
mirror of https://github.com/primer/css.git synced 2024-11-30 11:17:05 +03:00

rejigger cibuild logic for push builds only

This commit is contained in:
Shawn Allen 2017-07-25 10:23:41 -07:00
parent d0d0e7d506
commit 71dad239ad

View File

@ -5,41 +5,19 @@ set -e
# which makes this easier to test locally
args=$@
event="$TRAVIS_EVENT_TYPE"
branch="$TRAVIS_BRANCH"
# use $TRAVIS_PULL_REQUEST_BRANCH if this is a PR
if [[ "$event" = "pull_request" ]]; then
branch="$TRAVIS_PULL_REQUEST_BRANCH"
fi
branch=$TRAVIS_BRANCH
echo "===== CI build ====="
echo " event: $event"
echo " branch: $branch"
echo "===================="
if [[ "$event" = "" || "$branch" = "" ]]; then
echo '❌ Missing $TRAVIS_EVENT_TYPE or $TRAVIS_BRANCH!'
exit 1
fi
# release branches publish a release candidate
if [[ "$branch" =~ ^release- ]]; then
# only publish RCs for push builds
if [[ "$event" = "push" ]]; then
if [[ "$TRAVIS_EVENT_TYPE" = "pull_request" ]]; then
target_branch=$TRAVIS_PULL_REQUEST_BRANCH
if [[ "$target_branch" =~ ^release ]]; then
script/notify pending
script/release-candidate $args
script/notify success
else
echo "⚠️ This appears to be a release branch, but we only publish *push* builds."
echo "(TRAVIS_EVENT_TYPE: $event)"
exit 1
fi
# always publish a pr release if this is a PR build
elif [[ "$event" = "pull_request" ]]; then
elif [[ "$target_branch" = "dev" ]]; then
script/notify pending
script/release-pr $args
script/notify success
# publish a release when we merge to master
fi
elif [[ "$branch" = "master" ]]; then
script/notify pending
script/release $args
@ -48,4 +26,3 @@ else
echo "⚠️ This isn't a PR and '$branch' isn't a release branch."
exit 1
fi