diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..99e54d8 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,20 @@ +language: rust + +install: + - bash ci/install.sh + +script: + - bash ci/script.sh + +after_success: + - bash ci/after-success.sh + +branches: + only: + - master + - staging + - trying + +notifications: + email: + on_success: never diff --git a/ci/after-success.sh b/ci/after-success.sh new file mode 100644 index 0000000..6a08497 --- /dev/null +++ b/ci/after-success.sh @@ -0,0 +1,17 @@ +set -euxo pipefail + +main() { + mkdir ghp-import + curl -Ls https://github.com/davisp/ghp-import/archive/master.tar.gz | + tar --strip-components 1 -C ghp-import -xz + + ./ghp-import/ghp_import.py book + + # NOTE(+x) don't print $GH_TOKEN to the console! + set +x + git push -fq https://$GH_TOKEN@github.com/$TRAVIS_REPO_SLUG.git gh-pages && echo OK +} + +if [ $TRAVIS_BRANCH = master ] && [ $TRAVIS_PULL_REQUEST = false ]; then + main +fi diff --git a/ci/install.sh b/ci/install.sh new file mode 100644 index 0000000..989d73b --- /dev/null +++ b/ci/install.sh @@ -0,0 +1,15 @@ +set -euxo pipefail + +main() { + local tag=$(git ls-remote --tags --refs --exit-code https://github.com/rust-lang-nursery/mdbook \ + | cut -d/ -f3 \ + | grep -E '^v[0.1.0-9.]+$' \ + | sort --version-sort \ + | tail -n1) + curl -LSfs https://japaric.github.io/trust/install.sh | \ + sh -s -- --git rust-lang-nursery/mdbook --tag $tag + + pip install linkchecker --user +} + +main diff --git a/ci/script.sh b/ci/script.sh new file mode 100644 index 0000000..566894b --- /dev/null +++ b/ci/script.sh @@ -0,0 +1,9 @@ +set -euxo pipefail + +main() { + mdbook build + + linkchecker book +} + +main