Skip to content

Instantly share code, notes, and snippets.

@hamaluik
Last active October 16, 2015 23:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hamaluik/fab1ce12d2fb84f1f888 to your computer and use it in GitHub Desktop.
Save hamaluik/fab1ce12d2fb84f1f888 to your computer and use it in GitHub Desktop.
Git hook for updating the version file
#!/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