Skip to content

Commit

Permalink
[infra] exit succesfully when no docs changes
Browse files Browse the repository at this point in the history
This detects when no docs changes are present in the docs deployer
script, and exits with code 0 instead of code 1, so the deploy is
treated as successful.

Fixes: #136
  • Loading branch information
DirectXMan12 authored and frozencemetery committed Feb 16, 2018
1 parent b141894 commit 85f8688
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .travis/docs-deploy.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash -ex

# NB (very important): BE VERY CAREFUL WITH `set -x` FOR THIS FILE.
# The GitHub token is sensative information, and should never
# The GitHub token is sensitive information, and should never
# be displayed on in the clear.

source_directory=${1?need <source dir> <target dir> <target repo> [<target branch, default: gh-pages>]}
Expand All @@ -24,6 +24,12 @@ echo $desc > ${scratch_dir}/docs/${target_directory}/.from
pushd $scratch_dir/docs
git config user.email "deploy@travis-ci.org"
git config user.name "Deployment Bot (from Travis CI)"

if [[ $(git status --porcelain | wc -l) -eq 0 ]]; then
echo "no docs changes in the latest commit"
exit 0
fi

git add ${target_directory}
git commit -m "Update ${target_directory} docs in based on ${desc}"

Expand Down

0 comments on commit 85f8688

Please sign in to comment.