rtic/ci/after-success.sh

43 lines
1 KiB
Bash
Raw Normal View History

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/
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
}
# 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