1
1
mirror of https://github.com/primer/css.git synced 2024-12-26 07:35:04 +03:00
css/script/notify

36 lines
942 B
Plaintext
Raw Normal View History

#!/bin/bash
set -e
2017-07-25 21:58:52 +03:00
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
2017-07-21 01:38:14 +03:00
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
2017-07-21 01:24:04 +03:00
# 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"