Skip to content

Instantly share code, notes, and snippets.

@glenjamin
Last active February 7, 2016 21:07
Show Gist options
  • Save glenjamin/6035d383af18ce27046a to your computer and use it in GitHub Desktop.
Save glenjamin/6035d383af18ce27046a to your computer and use it in GitHub Desktop.
Script that automatically rebuilds a github pages branch
#!/bin/sh
set -e
# !!!!
echo "*** REPLACE this with the line which builds docs"
# !!!!
echo "*** Docs built ***"
tmpdir=`mktemp -d /tmp/gh-pages-build.XXXXXX`
mv doc/** $tmpdir
rmdir doc
git checkout gh-pages
git rm -rf .
mv $tmpdir/** .
git add -Av .
git commit -m "Updated docs"
echo "*** gh-pages branch updated ***"
rmdir $tmpdir
git checkout -
echo "Run this to complete:"
echo "git push origin gh-pages:gh-pages"
@glenjamin
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment