1
1
mirror of https://github.com/primer/css.git synced 2024-12-30 17:45:51 +03:00
css/script/notify
2017-07-25 11:58:52 -07:00

36 lines
942 B
Bash
Executable File

#!/bin/bash
set -e
if [[ "$CI" != "true" ]]; then
echo "(notify bailing: not in CI)"
exit
elif [[ $# -lt 1 ]]; then
echo "No status provided!" >&2
exit 1
fi
# the commit status context
context="npm publish"
_status=$1
# get the published version of primer-css from its package.json
package=primer-css
version=$(jq -r .version modules/$package/package.json)
published="$package@$version"
message=""
if [[ "$_status" = "success" ]]; then
# TODO point this at the contributing docs!
message="https://unpkg.com/$published/build/build.css"
fi
# XXX this will go away if we build pushes instead of PRs
if [[ "$TRAVIS_PULL_REQUEST_SHA" != "" ]]; then
# setting TRAVIS_COMMIT inline here is a fix for:
# <https://github.com/taskworld/commit-status/issues/5>
export TRAVIS_COMMIT=$TRAVIS_PULL_REQUEST_SHA
fi
echo "📡 Transmitting publish status for $published..."
commit-status "$_status" "$context" "$published" "$message"