Skip to content

Instantly share code, notes, and snippets.

@ccfelix
Last active June 6, 2020 00:06
Show Gist options
  • Save ccfelix/b300e42851ae43f01e9ea0165e2d47df to your computer and use it in GitHub Desktop.
Save ccfelix/b300e42851ae43f01e9ea0165e2d47df to your computer and use it in GitHub Desktop.
post-receive
#!/bin/bash
GIT_WORK_TREE=/var/www/sub_temp git checkout -f
changedfiles=( `git diff-tree --no-commit-id --name-only HEAD^ HEAD` )
cd /var/www/sub_temp/
# check if composer has been updated, if so install
# Check if the composer.lock file is present
if [[ "${changedfiles[*]}" =~ "composer.lock" ]]; then
# Install or update packages specified in the lock file
echo "****** composer.lock has been updated - do install ******"
composer install --no-dev
fi
php artisan config:cache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment