-
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f6cc715
commit 335f930
Showing
3 changed files
with
27 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/book | ||
/theme/highlight.js | ||
/theme/head.hbs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,39 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
set -eo pipefail | ||
|
||
pushd ./book | ||
|
||
# First build our custom highlight.js | ||
./ci/build-highlight-js | ||
# If there is a BASE_URL defined insert that into the head section of the | ||
# book | ||
if [[ ! -z "$BASE_URL" ]]; then | ||
echo "Inserting BASE_URL: $BASE_URL" | ||
echo "<base href=\"$BASE_URL\" />" > theme/head.hbs | ||
else | ||
echo "not using BASE_URL" | ||
fi | ||
|
||
# Check if mdbook is installed, otherwise download the binaries | ||
mdbook="mdbook" | ||
if ! [ -x "$(command -v $mdbook)" ]; then | ||
# Ensure cargo is installed | ||
if ! [ -x "$(command -v cargo)" ]; then | ||
# Install rust & cargo | ||
curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
# We have to source the installation | ||
source $HOME/.cargo/env | ||
fi | ||
|
||
# Install mdBook from source | ||
echo "Installing mdbook.." | ||
curl -sL https://github.com/rust-lang-nursery/mdBook/releases/download/v0.3.1/mdbook-v0.3.1-x86_64-unknown-linux-gnu.tar.gz | tar zxv | ||
mdbook="./mdbook" | ||
cargo install --git https://github.com/rust-lang/mdBook.git mdbook | ||
fi | ||
|
||
# First build our custom highlight.js | ||
./ci/build-highlight-js | ||
|
||
# Actually build the book | ||
echo 'Building book..' | ||
$mdbook build | ||
|
||
popd | ||
popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters