diff --git a/.travis.yml b/.travis.yml
index 672f7cb..aa4295e 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,12 +1,9 @@
language: rust
install:
- - sudo pip install ghp-import
+ - .travis/docs/install
script:
- cargo test
- cargo bench
- cargo doc --no-deps
-after_success: |
- echo '' > target/doc/index.html &&\
- ghp-import -n target/doc &&\
- git remote set-url origin https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}.git &&\
- git push -f origin gh-pages
+after_success:
+ - .travis/docs/after_success
diff --git a/.travis/docs/after_success b/.travis/docs/after_success
new file mode 100755
index 0000000..1da3c26
--- /dev/null
+++ b/.travis/docs/after_success
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+
+if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then
+ echo '' > target/doc/index.html
+ ghp-import -n target/doc
+ git remote set-url origin "https://${TOKEN}@github.com/${TRAVIS_REPO_SLUG}"
+ git push -f origin gh-pages
+fi
diff --git a/.travis/docs/install b/.travis/docs/install
new file mode 100755
index 0000000..eb9d476
--- /dev/null
+++ b/.travis/docs/install
@@ -0,0 +1,6 @@
+#!/bin/bash
+set -e
+
+if [ "$TRAVIS_PULL_REQUEST" = false ] && [ "$TRAVIS_BRANCH" = master ]; then
+ sudo pip install ghp-import
+fi