Last active
October 16, 2015 23:52
-
-
Save hamaluik/fab1ce12d2fb84f1f888 to your computer and use it in GitHub Desktop.
Git hook for updating the version file
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
#!/bin/sh | |
# find node | |
NODE=$(which node) | |
# get the latest commit | |
COMMIT=$(git rev-parse HEAD) | |
# if it cannot find a node installation | |
if [[ -z $NODE ]]; then | |
#NodeJS is not installed | |
echo "Please install NodeJS first." | |
exit 1 | |
fi | |
# update the version file | |
"$NODE" ./update-version.js "$COMMIT" | |
ret=$? | |
if [ ret -ne 0 ]; then | |
exit | |
fi | |
# generate documentation | |
echo "> Generating documentation..." | |
cd docs/pages | |
git pull | |
cd ../.. | |
haxe ./docs.hxml | |
ret=$? | |
if [ ret -ne 0 ]; then | |
exit | |
fi | |
echo "> Done!" | |
# upload the documentation to gh-pages | |
echo "> Uploading documentation..." | |
cd docs/pages | |
git add -A | |
git commit -m "Following master/$COMMIT" | |
git push origin gh-pages | |
cd ../.. | |
echo "> Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment