rtic/ci/after-success.sh

39 lines
880 B
Bash
Raw Normal View History

2018-08-27 14:44:47 +02:00
set -euxo pipefail
main() {
2018-11-03 17:02:41 +01:00
rm -f .cargo/config
cargo doc --features timer-queue
( cd book && mdbook build )
( cd ru && mdbook build )
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
cp -r book/book $td/
cp -r ru/book $td/book/ru
2018-11-03 17:02:41 +01:00
cp LICENSE-* $td/book/
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
2018-11-03 17:02:41 +01:00
if [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ]; then
2018-08-27 14:44:47 +02:00
main
fi