1
1
mirror of https://github.com/primer/css.git synced 2024-12-02 07:53:06 +03:00
css/script/notify
2017-11-09 09:41:18 -08:00

36 lines
934 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 from its package.json
package=primer
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"