Skip to content

Instantly share code, notes, and snippets.

@Grynn
Created March 12, 2023 17:02
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 Grynn/262c8319f5b8e5fdc67e310dbb6b4a3f to your computer and use it in GitHub Desktop.
Save Grynn/262c8319f5b8e5fdc67e310dbb6b4a3f to your computer and use it in GitHub Desktop.
post_receive_hook
#!/bin/bash
# Post recv. hook to run deploy.sh from within repo in checkout dir
set -e -u -o nounset
echo "ARGS****************"
read oldrev newrev ref
echo "OLD=$oldrev" "NEW=$newrev" "REF=$ref"
echo "********************"
if [ $ref == "refs/heads/master" ] || [[ $ref == refs/heads/main ]] ; then
eval "$(git show master:deploy.sh)"
else
echo "Ignoring push to $ref"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment