Last active
September 28, 2016 08:51
-
-
Save piaoger/5cf83dfc58fb48d6f4dd18eb5f5444a8 to your computer and use it in GitHub Desktop.
generate gh-pages
This file contains hidden or 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
gitconfig() { | |
git config user.name "piaoger" | |
git config user.email "[email protected]" | |
} | |
rev=$(git rev-parse --short HEAD) | |
depot=https://github.com/piaoger/playground-rust.git | |
rm -rf build/docs | |
mkdir build/docs | |
cd build/docs | |
remoteghpages=$(git branch --all | grep remotes/origin/gh-pages) | |
echo "$remoteghpages" | |
if [ ">>$remoteghpages" == ">>" ]; then | |
echo "initialize gh-pages branch" | |
git init | |
git remote add origin "$depot" | |
git checkout --orphan gh-pages | |
echo "$rev" > README.md | |
git add README.md | |
gitconfig | |
git commit -m "initial commit" | |
git push origin gh-pages | |
else | |
echo "fetch remote gh-pages branch" | |
git init | |
git remote add upstream "$depot" | |
git fetch upstream gh-pages && git reset upstream/gh-pages | |
cp ../../tests/bubplay.html bubplay.html | |
git add -A . | |
gitconfig | |
git commit -m "rebuild pages at ${rev}" | |
git push -q upstream HEAD:gh-pages | |
fi | |
cd ../../ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment