]> git.proxmox.com Git - rustc.git/blob - src/vendor/mdbook/deploy.sh
New upstream version 1.17.0+dfsg1
[rustc.git] / src / vendor / mdbook / deploy.sh
1 #!/bin/bash
2
3 # Exit on error or variable unset
4 set -o errexit -o nounset
5
6 NC='\033[39m'
7 CYAN='\033[36m'
8 GREEN='\033[32m'
9
10 rev=$(git rev-parse --short HEAD)
11
12 echo -e "${CYAN}Running cargo doc${NC}"
13 # Run cargo doc
14 cargo doc
15
16 echo -e "${CYAN}Running mdbook build${NC}"
17 # Run mdbook to generate the book
18 target/"$TARGET"/debug/mdbook build book-example/
19
20 echo -e "${CYAN}Copying book to target/doc${NC}"
21 # Copy files from rendered book to doc root
22 cp -R book-example/book/* target/doc/
23
24 cd target/doc
25
26 echo -e "${CYAN}Initializing Git${NC}"
27 git init
28 git config user.name "Mathieu David"
29 git config user.email "mathieudavid@mathieudavid.org"
30
31 git remote add upstream "https://$GH_TOKEN@github.com/azerupi/mdBook.git"
32 git fetch upstream
33 git reset upstream/gh-pages
34
35 touch .
36
37 echo -e "${CYAN}Pushing changes to gh-pages${NC}"
38 git add -A .
39 git commit -m "rebuild pages at ${rev}"
40 git push -q upstream HEAD:gh-pages
41
42 echo -e "${GREEN}Deployement done${NC}"