2018-11-11 08:19:04 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
2018-11-08 22:19:51 -08:00
|
|
|
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
|
|
|
|
_() {
|
|
|
|
echo "--- $*"
|
|
|
|
"$@"
|
|
|
|
}
|
|
|
|
|
|
|
|
maybe_install() {
|
|
|
|
for cmd in "$@"; do
|
|
|
|
set +e
|
|
|
|
"$cmd" --help > /dev/null 2>&1
|
|
|
|
declare exitcode=$?
|
|
|
|
set -e
|
|
|
|
if [[ $exitcode -ne 0 ]]; then
|
|
|
|
_ cargo install "$cmd"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
2018-11-26 17:39:20 -08:00
|
|
|
book/build.sh
|
2018-11-08 22:19:51 -08:00
|
|
|
|
|
|
|
echo --- create book repo
|
|
|
|
(
|
|
|
|
set -x
|
2018-11-26 08:12:22 -08:00
|
|
|
cd book/html/
|
2018-11-08 22:19:51 -08:00
|
|
|
git init .
|
|
|
|
git config user.email "maintainers@solana.com"
|
|
|
|
git config user.name "$(basename "$0")"
|
|
|
|
git add ./* ./.nojekyll
|
2018-11-17 10:17:14 -08:00
|
|
|
git commit -m "${BUILDKITE_COMMIT:-local}"
|
2018-11-08 22:19:51 -08:00
|
|
|
)
|
|
|
|
|
|
|
|
echo --- publish
|
|
|
|
if [[ $BUILDKITE_BRANCH = master ]]; then
|
|
|
|
(
|
|
|
|
set -x
|
2018-11-26 08:12:22 -08:00
|
|
|
cd book/html/
|
2018-11-08 22:19:51 -08:00
|
|
|
git remote add origin git@github.com:solana-labs/solana.git
|
|
|
|
git push -f origin HEAD:gh-pages
|
|
|
|
)
|
|
|
|
else
|
|
|
|
echo "Publish skipped"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 0
|