Last active
July 24, 2016 22:20
post-receive hook for git deploy (Laravel 4)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
WEBROOT=/var/www/domain.com/project | |
GIT_WORK_TREE=$WEBROOT git checkout -f | |
#change directory to the project dir | |
cd $WEBROOT | |
rm -f storage/cache/* | |
echo 'cache cleared' | |
rm -f storage/views/* | |
echo 'views cleared' | |
# Check if a composer.json file is present | |
if [ -f composer.json ]; then | |
# Detect composer binary | |
if which composer >/dev/null; then | |
composer='composer' | |
elif which composer.phar >/dev/null; then | |
composer='composer.phar' | |
else | |
# Install composer | |
curl -s http://getcomposer.org/installer | php >/dev/null | |
composer='php composer.phar' | |
fi | |
# Install or update packages specified in the lock file | |
$composer install | |
fi | |
# migrate database if required | |
php artisan migrate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment