-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4f3bbc0
commit a61d833
Showing
1 changed file
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
ORG=release-engineering | ||
REPO=pubtools-iib | ||
|
||
enabled(){ | ||
if [ "$TRAVIS_BRANCH" != "master" ] || [ "$TRAVIS_PULL_REQUEST" != "false" ]; then | ||
return 1 | ||
fi | ||
} | ||
|
||
set -x | ||
|
||
rev=$(git rev-parse --short HEAD) | ||
version=$(python ./setup.py --version | cut -d. -f1,2) | ||
|
||
cd docs/build/html | ||
|
||
git init | ||
git config user.name "${GITHUB_AUTHOR:-doc bot}" | ||
git config user.email "${GITHUB_EMAIL:-no-reply@redhat.com}" | ||
|
||
if enabled; then | ||
git remote add origin "https://$GITHUB_TOKEN@github.com/$ORG/$REPO.git" | ||
git fetch origin | ||
if git rev-parse origin/gh-pages; then | ||
git reset origin/gh-pages | ||
fi | ||
fi | ||
|
||
git add -A . | ||
git commit -m "Build documentation for ${version} at ${rev}" | ||
|
||
if enabled; then | ||
git push -q origin HEAD:refs/heads/gh-pages | ||
else | ||
echo "Docs would now be pushed, if this were submitted to master." | ||
fi |