forked from rust-lang/mdBook
-
Notifications
You must be signed in to change notification settings - Fork 1
/
deploy.sh
42 lines (30 loc) · 963 Bytes
/
deploy.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
#!/bin/bash
# Exit on error or variable unset
set -o errexit -o nounset
NC='\033[39m'
CYAN='\033[36m'
GREEN='\033[32m'
rev=$(git rev-parse --short HEAD)
echo -e "${CYAN}Running cargo doc${NC}"
# Run cargo doc
cargo doc
echo -e "${CYAN}Running mdbook build${NC}"
# Run mdbook to generate the book
target/$TARGET/debug/mdbook build book-example/
echo -e "${CYAN}Copying book to target/doc${NC}"
# Copy files from rendered book to doc root
cp -R book-example/book/* target/$TARGET/doc/
cd target/$TARGET/doc
echo -e "${CYAN}Initializing Git${NC}"
git init
git config user.name "Mathieu David"
git config user.email "[email protected]"
git remote add upstream "https://[email protected]/azerupi/mdBook.git"
git fetch upstream
git reset upstream/gh-pages
touch .
echo -e "${CYAN}Pushing changes to gh-pages${NC}"
git add -A .
git commit -m "rebuild pages at ${rev}"
git push -q upstream HEAD:gh-pages
echo -e "${GREEN}Deployement done${NC}"