2017-07-14 02:09:47 +03:00
|
|
|
#!/bin/bash
|
|
|
|
set -e
|
|
|
|
|
|
|
|
args=${@:1}
|
|
|
|
package=primer-css
|
2017-07-14 02:17:36 +03:00
|
|
|
npm_tag=pr
|
2017-07-14 02:09:47 +03:00
|
|
|
# the commit status context
|
2017-07-14 02:17:36 +03:00
|
|
|
context=npm/publish/${npm_tag}
|
2017-07-14 02:09:47 +03:00
|
|
|
|
2017-07-14 02:36:27 +03:00
|
|
|
echo "🐦 Publishing PR release to dist-tag '${npm_tag}'..."
|
2017-07-14 02:17:36 +03:00
|
|
|
lerna publish --npm-tag=${npm_tag} --canary --no-git ${args}
|
2017-07-14 02:09:47 +03:00
|
|
|
|
2017-07-14 02:36:27 +03:00
|
|
|
# get the published version of primer-css from its package.json
|
2017-07-14 02:09:47 +03:00
|
|
|
version=`jq -r .version modules/${package}/package.json`
|
|
|
|
slug="${package}@${version}"
|
|
|
|
|
|
|
|
echo "📡 Transmitting release success for ${slug} ..."
|
|
|
|
|
|
|
|
if [[ $TRAVIS_PULL_REQUEST_SHA ]]; then
|
|
|
|
# setting TRAVIS_COMMIT inline here is a fix for:
|
|
|
|
# <https://github.com/taskworld/commit-status/issues/5>
|
|
|
|
TRAVIS_COMMIT=$TRAVIS_PULL_REQUEST_SHA \
|
|
|
|
commit-status success ${context} \
|
|
|
|
"npm install ${slug}" \
|
|
|
|
"https://unpkg.com/${slug}/build/build.css"
|
|
|
|
fi
|