Publish book

This commit is contained in:
Michael Vines 2018-11-08 22:19:51 -08:00 committed by Greg Fitzgerald
parent b8261d7d83
commit eaa8b9cb1e
2 changed files with 55 additions and 1 deletions

View File

@ -13,4 +13,7 @@ steps:
name: "publish bpf sdk"
- command: "ci/publish-solana-tar.sh"
timeout_in_minutes: 15
name: "publish solana release tar"
name: "publish release tarball"
- command: "ci/publish-book.sh"
timeout_in_minutes: 15
name: "publish book"

51
ci/publish-book.sh Executable file
View File

@ -0,0 +1,51 @@
#!/bin/bash -e
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
}
export PATH=$CARGO_HOME/bin:$PATH
maybe_install mdbook
_ mdbook test
_ mdbook build
echo --- create book repo
(
set -x
cd book/
git init .
git config user.email "maintainers@solana.com"
git config user.name "$(basename "$0")"
git commit -m "Initial commit" --allow-empty
git add ./* ./.nojekyll
git commit -m "$BUILDKITE_COMMIT"
)
echo --- publish
if [[ $BUILDKITE_BRANCH = master ]]; then
(
set -x
cd book/
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