Created
April 9, 2017 19:33
-
-
Save harrysbaraini/f82704827e2e1e9dbe311ab1cc8da2c3 to your computer and use it in GitHub Desktop.
Git hooks for Laravel
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/bash | |
# | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" | |
} | |
check_run composer.json "composer install" | |
check_run package.json "yarn" | |
check_run bower.json "bower install" | |
yarn run production | |
chgrp -R www-data storage bootstrap/cache | |
chmod -R ug+rwx storage bootstrap/cache | |
echo "Artisan tasks" | |
php artisan down | |
php artisan migrate | |
php artisan cache:clear | |
#php artisan config:cache | |
#php artisan route:cache | |
php artisan view:clear | |
php artisan optimize | |
php artisan storage:link | |
php artisan up |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment