2018-12-05 09:32:49 +03:00
|
|
|
#!/bin/bash
|
2018-12-04 00:56:10 +03:00
|
|
|
set -e
|
2018-12-05 09:32:49 +03:00
|
|
|
|
2018-12-01 03:29:31 +03:00
|
|
|
if [ -z "$NOW_TOKEN" ]; then
|
|
|
|
echo "NOW_TOKEN is not set; skipping docs deployment"
|
|
|
|
else
|
2018-12-05 12:41:19 +03:00
|
|
|
cp modules/primer/build/build.css docs/static/primer.css
|
2018-12-04 00:56:10 +03:00
|
|
|
cd docs
|
2018-12-08 01:54:00 +03:00
|
|
|
npm run sync
|
2019-01-03 09:09:33 +03:00
|
|
|
|
2019-01-03 09:53:31 +03:00
|
|
|
version=$(cat ../VERSION)
|
2019-01-03 09:09:33 +03:00
|
|
|
actual=$(jq -r .dependencies.primer package.json)
|
|
|
|
|
|
|
|
# here, we need to manually update the primer dependency
|
|
|
|
# version to the one that we published
|
|
|
|
echo "primer has '$version' in package.json; docs wants '$actual'"
|
|
|
|
jq ".dependencies.primer = \"$version\"" package.json > package.json.tmp
|
|
|
|
mv package.json.tmp package.json
|
|
|
|
|
2019-01-03 09:53:31 +03:00
|
|
|
now_args="--token=$NOW_TOKEN"
|
|
|
|
now $now_args | tee now-url.txt
|
2018-12-05 09:32:49 +03:00
|
|
|
url=$(cat now-url.txt)
|
2018-12-05 12:54:51 +03:00
|
|
|
npx commit-status success docs "deployed primer@$version to $url" "$url"
|
2018-12-22 00:19:12 +03:00
|
|
|
if [[ $TRAVIS_EVENT_TYPE = "pull_request" ]]; then
|
|
|
|
branch=$TRAVIS_PULL_REQUEST_BRANCH
|
|
|
|
else
|
|
|
|
branch=$TRAVIS_BRANCH
|
|
|
|
fi
|
2018-12-22 01:53:06 +03:00
|
|
|
alias="primer-css-${branch//\./-}.now.sh"
|
2018-12-21 22:12:11 +03:00
|
|
|
echo "aliasing..."
|
2019-01-03 09:53:31 +03:00
|
|
|
now $now_args alias $url $alias
|
2018-12-21 23:14:21 +03:00
|
|
|
url="https://$alias"
|
|
|
|
npx commit-status success docs "deployed primer@$version to $url" "$url"
|
2018-12-01 03:29:31 +03:00
|
|
|
fi
|