Skip to content

Instantly share code, notes, and snippets.

@ahaneef29
Forked from gravitano/Envoy.blade.php
Created January 22, 2020 10:36
Show Gist options
  • Save ahaneef29/5d42a872559f9b0a7b790f77394269ba to your computer and use it in GitHub Desktop.
Save ahaneef29/5d42a872559f9b0a7b790f77394269ba to your computer and use it in GitHub Desktop.
Simple laravel envoy deploy script :)
@servers(['web' => 'root@127.0.0.1'])
@setup
$root = '~/public_html';
$dir = $root . '/laravel';
$branch = 'master';
$artisan = $dir . '/artisan';
$composer = '~/composer.phar';
$repo = 'git@domain.com:username/repository.git';
@endsetup
@macro('deploy')
down
pull
env
update
migrate
up
@endmacro
@task('fetch')
cd {{ $root }};
if [ -d {{ $dir }} ]; then
rm -rf {{ $dir }};
fi;
git clone -b {{ $branch }} {{ $repo }} {{ $dir }};
@endtask
@task('pull')
cd {{ $dir }} && git pull origin {{ $branch }}
@endtask
@task('update')
cd {{ $dir }} && {{ $composer }} update -v
@endtask
@task('install')
cd {{ $dir }} && {{ $composer }} install -v
@endtask
@task('env')
cp {{ $dir }}/.env.production {{ $dir }}/.env
@endtask
@task('down')
if [ -f {{ $artisan }} ]; then
php {{ $artisan }} down
else
echo "Artisan file not found!"
fi
@endtask
@task('up')
if [ -f {{ $artisan }} ]; then
php {{ $artisan }} up
else
echo "Artisan file not found!"
fi
@endtask
@task('migrate')
if [ -f {{ $artisan }} ]; then
php {{ $artisan }} migrate --force
else
echo "Artisan file not found!"
fi
@endtask
@task('migrate:refresh')
if [ -f {{ $artisan }} ]; then
php {{ $artisan }} migrate:refresh --force
else
echo "Artisan file not found!"
fi
@endtask
@task('seed')
if [ -f {{ $artisan }} ]; then
php {{ $artisan }} db:seed --force
else
echo "Artisan file not found!"
fi
@endtask
@task('migrate:reset')
if [ -f {{ $artisan }} ]; then
php {{ $artisan }} migrate:reset --force
else
echo "Artisan file not found!"
fi
@endtask
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment