solana/ci/publish-book.sh

45 lines
806 B
Bash
Raw Normal View History

#!/usr/bin/env bash
set -e
2018-11-08 22:19:51 -08:00
cd "$(dirname "$0")/.."
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
git commit -m "${BUILDKITE_COMMIT:-local}"
2018-11-08 22:19:51 -08:00
)
eval "$(ci/channel-info.sh)"
# Only publish the book from the edge and beta channels for now.
case $CHANNEL in
edge)
repo=git@github.com:solana-labs/book-edge.git
;;
beta)
repo=git@github.com:solana-labs/book.git
;;
*)
echo "--- publish skipped"
exit 0
;;
esac
echo "--- publish $CHANNEL"
cd book/html/
git remote add origin $repo
git fetch origin master
if ! git diff HEAD origin/master --quiet; then
git push -f origin HEAD:master
2018-11-08 22:19:51 -08:00
else
echo "Content unchanged, publish skipped"
2018-11-08 22:19:51 -08:00
fi
exit 0