Created
January 27, 2011 19:41
-
-
Save tim-evans/799074 to your computer and use it in GitHub Desktop.
post-commit for committing docs
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
#!/bin/sh | |
# | |
# Deploys documentation | |
getGitBranchName() | |
{ | |
branch="$(git symbolic-ref HEAD 2>/dev/null)" || | |
"$(git describe --contains --all HEAD)" | |
echo ${branch##refs/heads/} | |
} | |
isOnMasterBranch() | |
{ | |
if [ "$(getGitBranchName)" = "master" ]; then | |
return 0 | |
fi | |
return 1 | |
} | |
isOnMasterBranch | |
if [ $? -ne 0 ]; then # ignore any branch *except* master | |
exit | |
fi | |
make clean | |
make | |
git checkout gh-pages | |
git rm -r symbols | |
git rm -r static | |
git rm index.html | |
rm -r src | |
rm -r test | |
mv docs/* ./ | |
rm -r docs | |
pushd symbols | |
# move src up a directory | |
mv src/* ./ | |
rm -r src | |
# rename _global_ => global to make Jekyll happy | |
for i in $(find . -type f); do sed 's/_global_/global/g' $i > $i-tmp; mv $i-tmp $i; done | |
mv _global_.html global.html | |
popd | |
sed 's/_global_/global/g' index.html > index.html.tmp | |
mv index.html.tmp index.html | |
git add . | |
git commit -m "Documentation updated to reflect master" | |
git checkout master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment