Improve post-receive hook messages

This commit is contained in:
thopic 2023-07-11 11:35:26 +02:00
parent 0b79ea838c
commit a9e0289159
Signed by: thopic
GPG Key ID: 292DBBF0B54AD4C5

View File

@ -16,6 +16,7 @@ REMOTE="local"
while read oldrev newrev ref while read oldrev newrev ref
do do
echo "Ref $ref (${newrev:0:7}) received."
# only checking out the master (or whatever branch you would like to deploy) # only checking out the master (or whatever branch you would like to deploy)
if [ "$ref" = "refs/heads/master" ]; if [ "$ref" = "refs/heads/master" ];
then then
@ -24,13 +25,13 @@ do
PROD_BR=`git rev-parse --abbrev-ref HEAD` PROD_BR=`git rev-parse --abbrev-ref HEAD`
if [ $PROD_BR != "master" ]; if [ $PROD_BR != "master" ];
then then
echo "Production repo is on $PROD_BR branch. Aborting..." echo "Doing nothing: production repo is on $PROD_BR branch."
else else
echo "Ref $ref (${newrev:0:7}) received. Deploying master branch to production..." echo "Deploying master branch to production..."
git pull --ff-only $REMOTE master git pull --ff-only $REMOTE master
fi fi
else else
echo "Ref $ref received. Doing nothing: only the master branch may be deployed on this server." echo "Doing nothing: only the master branch may be deployed on this server."
fi fi
done done
``` ```