Skip to content

Instantly share code, notes, and snippets.

@tadeubdev
Created January 5, 2023 12:25
Show Gist options
  • Save tadeubdev/4bd5e1e069fee26ad4a22514de22c340 to your computer and use it in GitHub Desktop.
Save tadeubdev/4bd5e1e069fee26ad4a22514de22c340 to your computer and use it in GitHub Desktop.
post-receive
#!/usr/bin/env bash
# Verifique se houve alterações no arquivo package.json ou composer.json
while read oldrev newrev refname
do
if [[ $(git diff --name-only $oldrev $newrev | grep "package\.json$") != "" ]]; then
rm -rf node_modules
npm install --production
fi
if [[ $(git diff --name-only $oldrev $newrev | grep "composer\.json$") != "" ]]; then
rm -rf vendor
composer install --no-dev
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment