From: Lisa Marie Maginnis Date: Mon, 6 Oct 2014 19:07:44 +0000 (-0400) Subject: Added new post-update hook for civicrm-core deployments X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=93eb548e7c9cf6cfcfc672c38731e67bb67e3839;p=deploy-hooks.git Added new post-update hook for civicrm-core deployments --- diff --git a/civicrm-core.git/post-update b/civicrm-core.git/post-update new file mode 100755 index 0000000..8411e95 --- /dev/null +++ b/civicrm-core.git/post-update @@ -0,0 +1,48 @@ +#!/bin/bash + +unset GIT_DIR +SELF=civicrm-core.git +REPO_DIR=$HOME/repositories +CHECKOUT_DIR=$HOME/local/checkouts/deploy-hooks +TARGET_DIR=/var/www/html/ + +case $1 in + refs/heads/master) + TARGET_HOST=crm.fsf.org + branch=master + ;; + refs/heads/stable) + TARGET_HOST=crm-dev.fsf.org + branch=stable + ;; + *) + echo "No action for this branch!" + ;; +esac + + +echo "Updating local checkout..." +if [ ! -d $CHECKOUT_DIR ]; then + git clone $REPO_DIR/$SELF $CHECKOUT_DIR + git checkout $branch + cd $CHECKOUT_DIR +else + cd $CHECKOUT_DIR + git checkout $branch + git pull origin $branch +fi + +if [ -n TARGET_HOST ]; then + echo "Deploying branch '$branch' to host '$TARGET_HOST'" + + echo "Uploading files to $TARGET_HOST web root..." + rsync -avrSPX --exclude='.git/' --delete $CHECKOUT_DIR/ + vcshookuser@$TARGET_HOST:$TARGET_DIR + + echo "Fixing permissions on webserver..." + ssh vcshookuser@$TARGET_HOST 'sudo /usr/loca/bin/fixperms.sh' +fi + +exec git update-server-info + +