forked from rust-lang/book
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgithub_pages.sh
48 lines (34 loc) · 1.09 KB
/
github_pages.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
# Deploys the `book-example` to GitHub Pages
set -ex
# Only run this on the master branch for stable
if [ "$TRAVIS_BRANCH" != "master" ] ||
[ "$TRAVIS_RUST_VERSION" != "stable" ]; then
exit 0
fi
# Make sure we have the css dependencies
npm install -g stylus nib
NC='\033[39m'
CYAN='\033[36m'
GREEN='\033[32m'
rev=$(git rev-parse --short HEAD)
# echo -e "${CYAN}Running cargo doc${NC}"
# cargo doc --features regenerate-css > /dev/null
echo -e "${CYAN}Running mdbook build${NC}"
cargo run -- build second-edition/
echo -e "${CYAN}Copying book to target/doc${NC}"
cp -R second-edition/book/* target/doc/
cd target/doc
echo -e "${CYAN}Initializing Git${NC}"
git init
git config user.name "cxumol"
git config user.email "[email protected]"
git remote add upstream "https://[email protected]/cxuauto/rust-book.git"
git fetch upstream --quiet
git reset upstream/gh-pages --quiet
touch .
echo -e "${CYAN}Pushing changes to gh-pages${NC}"
git add -A .
git commit -m "rebuild pages at ${rev}" --quiet
git push -q upstream HEAD:gh-pages --quiet
echo -e "${GREEN}Deployed docs to GitHub Pages${NC}"