Skip to content

Instantly share code, notes, and snippets.

@nabijaczleweli
Last active May 14, 2020 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nabijaczleweli/db8e714a97868c01160f60e99d3a5c06 to your computer and use it in GitHub Desktop.
Save nabijaczleweli/db8e714a97868c01160f60e99d3a5c06 to your computer and use it in GitHub Desktop.
Rust project documentation deployment script for TravisCI, insert into after_success section
if ( [ "$TRAVIS_BRANCH" = "master" ] || [ "$TRAVIS_BRANCH" = "trunk" ] || [ "$TRAVIS_BRANCH" = "develop" ] ) && [ "$TRAVIS_SECURE_ENV_VARS" = "true" ] && [ "$TRAVIS_RUST_VERSION" = "stable" ] && [ "$TRAVIS_COMMIT_RANGE" ] && ! [ "$TRAVIS_TAG" ]; then
(
echo "Update docs for commits $TRAVIS_COMMIT_RANGE";
echo;
git log "$TRAVIS_COMMIT_RANGE" --pretty=oneline;
) >> "$TRAVIS_BUILD_DIR/../DOC_UPDATE_MSG";
mkdir -p ~/.ssh && cp gh_rsa ~/.ssh/id_rsa && chmod 700 ~/.ssh && chmod 600 ~/.ssh/id_rsa;
git clone -b doc "git@github.com:$TRAVIS_REPO_SLUG.git" "$TRAVIS_BUILD_DIR-doc";
mkdir -p target;
cargo doc;
cp -rf target/doc/* "$TRAVIS_BUILD_DIR-doc"
pushd "$TRAVIS_BUILD_DIR-doc";
git config --global user.email "nabijaczleweli@gmail.com";
git config --global user.name "Nabijaczleweli Autouploader Bot";
git config --global push.default simple;
git add -- *;
git commit -F "$TRAVIS_BUILD_DIR/../DOC_UPDATE_MSG";
git push;
popd;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment