Skip to content

Commit

Permalink
Added push-docs helper script
Browse files Browse the repository at this point in the history
  • Loading branch information
midnightercz committed Feb 25, 2020
1 parent 4f3bbc0 commit a61d833
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions scripts/push-docs
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

0 comments on commit a61d833

Please sign in to comment.