forked from epfl-dias/mercator
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupload_docs.sh
More file actions
executable file
·33 lines (26 loc) · 882 Bytes
/
upload_docs.sh
File metadata and controls
executable file
·33 lines (26 loc) · 882 Bytes
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
#!/bin/sh
: ${TRAVIS_REPO_SLUG="epfl-dias/${PROJECT}"}
if [ -z ${GH_TOKEN+yes} ]; then
echo "GH_TOKEN unset, exiting..."
exit 1
fi
if [ -z ${PROJECT+yes} ]; then
echo "PROJECT unset, exiting..."
exit 1
fi
# Generate the documentation
cargo doc --release --target-dir=target
cat > target/doc/index.html <<EOT
<meta http-equiv=refresh content=0;url=${PROJECT}/index.html>
EOT
# If a book folder exists, and mdbook is available, build it.
if /usr/bin/which -s mdbook && test -d book; then
mdbook build --dest-dir ../target/doc/book book
fi
# Upload it to GitHub.
MSG=$(git log -1 --pretty=format:'doc: %ci: %h - %s')
[ -e ../ghp-import/ghp_import.py ] || git clone https://github.com/davisp/ghp-import.git ../ghp-import
../ghp-import/ghp_import.py -n -p -f \
-m "${MSG}" \
-r "https://${GH_TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git" \
target/doc