2018-08-27 14:44:47 +02:00
|
|
|
set -euxo pipefail
|
|
|
|
|
|
|
|
main() {
|
2019-02-11 22:07:15 +01:00
|
|
|
local langs=( en ru )
|
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
rm -f .cargo/config
|
|
|
|
cargo doc --features timer-queue
|
2018-08-27 14:44:47 +02:00
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
local td=$(mktemp -d)
|
|
|
|
cp -r target/doc $td/api
|
2019-02-11 22:07:15 +01:00
|
|
|
mkdir $td/book/
|
2019-02-14 21:46:17 +01:00
|
|
|
cp redirect.html $td/book/index.html
|
2019-02-11 22:07:15 +01:00
|
|
|
for lang in ${langs[@]}; do
|
|
|
|
( cd book/$lang && mdbook build )
|
|
|
|
cp -r book/$lang/book $td/book/$lang
|
|
|
|
cp LICENSE-* $td/book/$lang/
|
|
|
|
done
|
2018-08-27 14:44:47 +02:00
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
mkdir ghp-import
|
2018-08-27 14:44:47 +02:00
|
|
|
curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz |
|
|
|
|
tar --strip-components 1 -C ghp-import -xz
|
|
|
|
|
2018-11-03 17:02:41 +01:00
|
|
|
./ghp-import/ghp_import.py $td
|
2018-08-27 14:44:47 +02:00
|
|
|
|
|
|
|
set +x
|
|
|
|
git push -fq https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages && echo OK
|
2018-11-03 17:02:41 +01:00
|
|
|
|
|
|
|
rm -rf $td
|
2018-08-27 14:44:47 +02:00
|
|
|
}
|
|
|
|
|
2019-02-08 19:58:55 +01:00
|
|
|
# fake Travis variables to be able to run this on a local machine
|
|
|
|
if [ -z ${TRAVIS_BRANCH-} ]; then
|
|
|
|
TRAVIS_BRANCH=master
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ -z ${TRAVIS_PULL_REQUEST-} ]; then
|
|
|
|
TRAVIS_PULL_REQUEST=false
|
|
|
|
fi
|
|
|
|
|
2019-05-02 11:15:30 +02:00
|
|
|
if { [ $TRAVIS_BRANCH = master ] || [ $TRAVIS_BRANCH = v0.4.x ]; } && [ $TRAVIS_PULL_REQUEST = false ]; then
|
2018-08-27 14:44:47 +02:00
|
|
|
main
|
|
|
|
fi
|