1
1
mirror of https://github.com/primer/css.git synced 2024-09-21 05:39:15 +03:00
css/script/cibuild
2017-07-20 17:28:05 -07:00

46 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -e
# --yes gets passed in by .travis.yml,
# which makes this easier to test locally
args=$@
event="$TRAVIS_EVENT_TYPE"
branch="${TRAVIS_PULL_REQUEST_BRANCH=${TRAVIS_BRANCH}}"
echo "==== CI env ===="
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
script/notify pending
script/release-candidate $args
script/notify success
fi
echo "⚠️ This appears to be a release branch, but we only publish *push* builds."
echo "(TRAVIS_EVENT_TYPE: $event)"
exit 1
# always publish a pr release if this is a PR build
elif [[ "$event" = "pull_request" ]]; then
script/notify pending
script/release-pr $args
script/notify success
# publish a release when we merge to master
elif [[ "$branch" = "master" ]]; then
script/notify pending
script/release $args
script/notify success
else
echo "⚠️ This isn't a PR and '$branch' isn't a release branch."
exit 1
fi