Last active
August 29, 2015 14:03
-
-
Save kiasaki/00a3044d12956a828e76 to your computer and use it in GitHub Desktop.
post-receive hook VPS
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 | |
echo "" | |
echo "-----" | |
echo "Transfering ..." | |
GIT_DIR=/home/<username>/repo/<app>.git | |
WWW_DIR=/var/www/<app>/current | |
git --work-tree=$WWW_DIR --git-dir=$GIT_DIR checkout -f | |
echo "-----" | |
echo "Running composer ..." | |
cd $WWW_DIR | |
composer install | |
echo "-----" | |
echo "Fetching src ..." | |
cd $WWW_DIR | |
GIT_WORK_TREE=$WWW_DIR git --git-dir=$GIT_DIR submodule update --init --recursive | |
echo "-----" | |
echo "Setting env vars" | |
if [ ! -f $WWW_DIR/env.php ]; then | |
ln -s $WWW_DIR/../env.php $WWW_DIR/env.php | |
fi | |
echo "-----" | |
echo "Running migrations" | |
cd $WWW_DIR | |
php sb db:migrate | |
echo "-----" | |
echo "Clearing cache" | |
rm -r $WWW_DIR/../tmp/cache/* | |
echo "-----" | |
echo "Tranfered to $WWW_DIR" | |
echo "-----" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment