Update to new Doc upload

This commit is contained in:
Mathijs van de Nes 2015-04-10 11:40:22 +02:00
parent 58d9b7a00e
commit 076f74e8e3
6 changed files with 49 additions and 35 deletions

View file

@ -11,15 +11,11 @@ notifications:
on_success: never
on_failure: always
env:
global:
- secure: "VeXvD0tLJyu38t87p8AAztSQVBxsCE1y016l/Nc44203V/RUxj4tz5ifaZcKziPqFHK2ITs2T6fBE1uu404zMVwA0W0J8vmG6+xDoJJLsbwKp4W3SlAI+oIEmFSTIxgzAB7hio17VPDmAqKbnbhbmbP+U94ygoztRNN3ObCZ8yo="
script:
- cargo build
- cargo test
- cargo doc --no-deps
- cargo doc
- rustdoc --test README.md -L target
after_success:
- .travis/publish_doc.sh
- .travis/travis-doc-upload.sh

BIN
.travis/id_rsa.enc Normal file

Binary file not shown.

View file

@ -1,28 +0,0 @@
#!/bin/bash
if [ "$TRAVIS_BRANCH" = "master" ] &&
[ "$TRAVIS_PULL_REQUEST" = "false" ] &&
[ "$TRAVIS_REPO_SLUG" = "mvdnes/zip-rs" ] &&
[ "$TRAVIS_RUST_VERSION" = "1.0.0-beta" ]
then
echo "Publishing documentation..."
cd $HOME
git clone --quiet --branch=gh-pages https://${GH_TOKEN}@github.com/mvdnes/zip-rs gh-pages > /dev/null
cd gh-pages
git config user.email "travis@travis-ci.org"
git config user.name "travis-ci"
git rm -rf . > /dev/null
cp -Rf $TRAVIS_BUILD_DIR/target/doc/* .
git reset HEAD -- index.html > /dev/null
git checkout -- index.html > /dev/null
git add -f .
git commit -m "Auto doc upload from travis"
git push -fq origin gh-pages > /dev/null
echo "Published documentation"
fi

View file

@ -0,0 +1,4 @@
PROJECT_NAME=zip-rs
DOCS_REPO=mvdnes/rust-docs.git
SSH_KEY_TRAVIS_ID=70a3dd61d838
DOC_RUST_VERSION=1.0.0-beta

42
.travis/travis-doc-upload.sh Executable file
View file

@ -0,0 +1,42 @@
#!/bin/sh
# License: CC0 1.0 Universal
# https://creativecommons.org/publicdomain/zero/1.0/legalcode
set -e
SCRIPT_PATH=.travis
. $SCRIPT_PATH/travis-doc-upload.cfg
[ "$TRAVIS_BRANCH" = master ]
[ "$TRAVIS_PULL_REQUEST" = false ]
[ "$TRAVIS_RUST_VERSION" = "$DOC_RUST_VERSION" ]
echo "Publishing docs..."
eval key=\$encrypted_${SSH_KEY_TRAVIS_ID}_key
eval iv=\$encrypted_${SSH_KEY_TRAVIS_ID}_iv
mkdir -p ~/.ssh
openssl aes-256-cbc -K $key -iv $iv -in $SCRIPT_PATH/id_rsa.enc -out ~/.ssh/id_rsa -d
chmod 600 ~/.ssh/id_rsa
git clone --branch gh-pages git@github.com:$DOCS_REPO deploy_docs
cd deploy_docs
git config user.name "doc upload bot"
git config user.email "nobody@example.com"
rm -rf $PROJECT_NAME
mv ../target/doc $PROJECT_NAME
git add -A $PROJECT_NAME
git commit -qm "doc upload for $PROJECT_NAME ($TRAVIS_REPO_SLUG)"
for i in {0..5}; do
git push -q origin gh-pages && break # redo when push fails
git pull -r || break # give up if rebase fails
done
echo "Doc upload completed"

View file

@ -3,7 +3,7 @@ zip-rs
[![Build Status](https://travis-ci.org/mvdnes/zip-rs.svg?branch=master)](https://travis-ci.org/mvdnes/zip-rs)
[Documentation](http://mvdnes.github.io/zip-rs/)
[Documentation](http://mvdnes.github.io/rust-docs/zip-rs/zip/index.html)
A zip library for rust wich supports reading and writing of simple ZIP files.