2015-08-01 13:24:00 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-08-05 18:47:21 +00:00
|
|
|
# Exit on error or variable unset
|
2015-08-01 13:24:00 +00:00
|
|
|
set -o errexit -o nounset
|
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
NC='\033[39m'
|
|
|
|
CYAN='\033[36m'
|
|
|
|
GREEN='\033[32m'
|
2015-08-06 11:06:26 +00:00
|
|
|
|
2015-08-01 13:24:00 +00:00
|
|
|
rev=$(git rev-parse --short HEAD)
|
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
echo -e "${CYAN}Running cargo doc${NC}"
|
2015-08-06 10:38:48 +00:00
|
|
|
# Run cargo doc
|
|
|
|
cargo doc
|
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
echo -e "${CYAN}Running mdbook build${NC}"
|
2015-08-05 18:47:21 +00:00
|
|
|
# Run mdbook to generate the book
|
2016-08-01 19:26:23 +00:00
|
|
|
target/"$TARGET"/debug/mdbook build book-example/
|
2015-08-05 18:47:21 +00:00
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
echo -e "${CYAN}Copying book to target/doc${NC}"
|
2015-08-06 10:38:48 +00:00
|
|
|
# Copy files from rendered book to doc root
|
2016-08-01 19:26:23 +00:00
|
|
|
cp -R book-example/book/* target/doc/
|
2015-08-06 10:38:48 +00:00
|
|
|
|
2016-08-01 19:26:23 +00:00
|
|
|
cd target/doc
|
2015-08-01 13:24:00 +00:00
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
echo -e "${CYAN}Initializing Git${NC}"
|
2015-08-01 13:24:00 +00:00
|
|
|
git init
|
|
|
|
git config user.name "Mathieu David"
|
|
|
|
git config user.email "mathieudavid@mathieudavid.org"
|
|
|
|
|
|
|
|
git remote add upstream "https://$GH_TOKEN@github.com/azerupi/mdBook.git"
|
|
|
|
git fetch upstream
|
|
|
|
git reset upstream/gh-pages
|
|
|
|
|
|
|
|
touch .
|
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
echo -e "${CYAN}Pushing changes to gh-pages${NC}"
|
2015-08-01 13:24:00 +00:00
|
|
|
git add -A .
|
|
|
|
git commit -m "rebuild pages at ${rev}"
|
|
|
|
git push -q upstream HEAD:gh-pages
|
2015-08-06 11:06:26 +00:00
|
|
|
|
2015-08-06 11:30:08 +00:00
|
|
|
echo -e "${GREEN}Deployement done${NC}"
|