Skip to content

Instantly share code, notes, and snippets.

@cmgmyr
Created August 19, 2013 18:02
Show Gist options
  • Save cmgmyr/6272152 to your computer and use it in GitHub Desktop.
Save cmgmyr/6272152 to your computer and use it in GitHub Desktop.
Laravel Git Deployment (multiple branches)
#!/bin/sh
#
# hook file name: post-update
echo
echo "**** Pulling changes into server [Hub's post-update hook]"
echo
case " $1 " in
*'refs/heads/develop'*)
cd /var/www/vhosts/domain.com/dev/ || exit
unset GIT_DIR
git pull hub develop
echo
echo "Develop was pulled"
echo
php artisan migrate --env=staging
;;
esac
case " $1 " in
*'refs/heads/master'*)
cd /var/www/vhosts/domain.com/httpdocs/ || exit
unset GIT_DIR
git pull hub master
echo
echo "Master was pulled"
echo
php artisan migrate --env=production
;;
esac
rm -f app/storage/cache/*
rm -f app/storage/views/*
chmod -R 777 app/storage
chmod -R 777 public/assets/uploads
exec git-update-server-info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment