Skip to content

Instantly share code, notes, and snippets.

@jaonoctus
Last active February 6, 2017 17:23
Show Gist options
  • Save jaonoctus/2b6f2fb783cbbca93f83f5043df2f7d0 to your computer and use it in GitHub Desktop.
Save jaonoctus/2b6f2fb783cbbca93f83f5043df2f7d0 to your computer and use it in GitHub Desktop.
git push deploy
#!/bin/bash
# Variables
USER_PATH='/home/user'
REPO_PATH=$USER_PATH'/repo'
PRODUCTION_PATH=$USER_PATH'/production'
while read oldrev newrev ref
do
branch=`echo $ref | cut -d/ -f3`
export GIT_DIR=$REPO_PATH
if [ "master" == "$branch" ]; then
echo "Deploying PRODUCTION"
export GIT_WORK_TREE=$PRODUCTION_PATH
git checkout -f $branch
cd $PRODUCTION_PATH
composer install
php artisan migrate --force
#gulp
php artisan cache:clear
fi
done
@jaonoctus
Copy link
Author

jaonoctus commented Jul 2, 2016

PRODUCTION

mkdir production
mkdir repo && cd repo
git init --bare
# create the post-receive file inside your REPO_PATH, then:
chmod +x post-receive

LOCAL

git remote add deploy USER@HOST:REPO_PATH
git push deploy --all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment