2017-07-21 01:21:46 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
2017-07-25 21:58:52 +03:00
|
|
|
if [[ "$CI" != "true" ]]; then
|
2018-06-29 01:54:13 +03:00
|
|
|
echo "(bailing: not in CI)"
|
2017-07-25 21:58:52 +03:00
|
|
|
exit
|
|
|
|
elif [[ $# -lt 1 ]]; then
|
2017-07-21 03:01:47 +03:00
|
|
|
echo "No status provided!" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-07-21 01:24:04 +03:00
|
|
|
# XXX this will go away if we build pushes instead of PRs
|
2017-07-21 01:21:46 +03:00
|
|
|
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
|
|
|
|
|
2018-06-29 01:54:13 +03:00
|
|
|
_status=$1
|
|
|
|
|
|
|
|
version=$(jq -r .version package.json)
|
|
|
|
name=$(jq -r .name package.json)
|
|
|
|
|
|
|
|
# the commit status context
|
|
|
|
context="npm publish $name"
|
|
|
|
message="https://unpkg.com/$name@$version/"
|
|
|
|
|
|
|
|
echo "📡 Transmitting publish status for $context $name@$version..."
|
|
|
|
commit-status "$_status" "$context" "$name@$version" "$message"
|