Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Commit

Permalink
Deploy documentation to github pages (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
sunchao committed May 4, 2018
1 parent a8c3220 commit 19a73e3
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,16 @@ rust:
script:
- cargo build
- cargo test
- cargo doc --no-deps

after_success:
- if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then
cargo bench;
fi
- cargo coveralls --verbose --exclude-pattern '/parquet-rs/src/bin'

- '[ "$TRAVIS_PULL_REQUEST" = false ] &&
{ [ "$TRAVIS_TAG" != "" ] || [ "$TRAVIS_BRANCH" = "master" ]; } &&
./ci/deploy-docs.sh'
env:
global:
- TRAVIS_CARGO_NIGHTLY_FEATURE=""
Expand Down
45 changes: 45 additions & 0 deletions ci/deploy-docs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#!/bin/bash

set -e

GITHUB_USER="doc-deploy-bot"
GITHUB_EMAIL=""

DOC_VERSION=${TRAVIS_TAG:-$TRAVIS_BRANCH}
if [ -z "$DOC_VERSION" ]; then
echo "Failed to find documentation version, make sure TRAVIS_TAG or TRAVIS_BRANCH is set"
exit 1
fi

echo "Deploying documentation version $DOC_VERSION"

# Check that GITHUB_TOKEN is set
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN is not set.
You’ll need to generate a personal access token with the 'public_repo'.
Since the token should be private, you’ll want to pass it to Travis securely
in your repository settings or via encrypted variables in .travis.yml."
exit 1
fi

if [ -d "target/doc" ]; then
echo "<meta http-equiv=refresh content=0;url=parquet/index.html>" > ./target/doc/index.html

echo "Setting up gh-pages branch" &&
git clone --branch gh-pages "https://$GITHUB_TOKEN@github.com/${TRAVIS_REPO_SLUG}.git" deploy_docs > /dev/null 2>&1 &&
cd deploy_docs &&
rm -rf ./$DOC_VERSION &&
mkdir ./$DOC_VERSION &&
mv ../target/doc/* ./$DOC_VERSION/ &&
git config user.name "$GITHUB_USER" &&
git config user.email "$GITHUB_EMAIL" &&
git add -A . &&
git commit -m "Deploy doc pages $DOC_VERSION at ${TRAVIS_COMMIT}" &&
echo "Pushing documentation update" &&
git push --quiet origin gh-pages > /dev/null 2>&1 &&
echo "Published documentation $DOC_VERSION" || echo "Failed to publish documentation $DOC_VERSION"
else
echo "Failed to find target/doc directory, have you built the docs?"
exit 1
fi

0 comments on commit 19a73e3

Please sign in to comment.