Created
April 29, 2019 10:20
-
-
Save lorne-luo/75d81886ce85868d36e98d0520ab27a1 to your computer and use it in GitHub Desktop.
Templates for Git hooks script
This file contains hidden or 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 | |
while read oldrev newrev refname | |
do | |
branch=$(git rev-parse --symbolic --abbrev-ref $refname) | |
if [ "master" == "$branch" ]; then | |
sudo git --git-dir=/home/git/ozsales.git --work-tree=/opt/ozsales checkout -f master >/dev/null | |
cd /opt/ozsales | |
PIP=/home/luotao/venv/ozsales/bin/pip | |
PYTHON=/home/luotao/venv/ozsales/bin/python | |
sudo ${PIP} install -r requirements.pip || exit 1 | |
sudo chown luotao /home/luotao/venv/ozsales -R | |
sudo ${PYTHON} manage.py migrate_schemas --shared | |
sudo ${PYTHON} manage.py migrate_schemas --tenant | |
sudo ${PYTHON} manage.py js_reverse | |
sudo gulp build | |
sudo ${PYTHON} manage.py collectstatic --noinput | |
sudo supervisorctl restart ozsales | |
sudo supervisorctl restart ozsales_celery | |
fi | |
done |
This file contains hidden or 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 | |
umask 002 | |
PROJECT=ozsales | |
git --git-dir=/home/git/${PROJECT}.git --work-tree=/opt/${PROJECT} diff --name-status -w | grep ^M | |
if [ $? -eq 0 ]; then | |
echo " | |
********************************** | |
** LOCAL MODIFICATIONS DETECTED ** | |
********************************** | |
Please fix and try again." | |
exit 127 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment