forked from baijunyao/laravel-bjyblog
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Envoy.blade.php
27 lines (24 loc) · 846 Bytes
/
Envoy.blade.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
@setup
require __DIR__.'/vendor/autoload.php';
$dotenv = Dotenv\Dotenv::create(__DIR__);
try {
$dotenv->load();
$dotenv->required(['DEPLOY_IP', 'DEPLOY_PORT', 'DEPLOY_USER', 'DEPLOY_PATH', 'DEPLOY_BRANCH'])->notEmpty();
} catch ( Exception $e ) {
echo $e->getMessage();
}
$ip = getenv('DEPLOY_IP');
$port = getenv('DEPLOY_PORT');
$user = getenv('DEPLOY_USER');
$path = getenv('DEPLOY_PATH');
$branch = getenv('DEPLOY_BRANCH');
if ( substr($path, 0, 1) !== '/' ) throw new Exception('Must be an absolute path');
$path = rtrim($path, '/');
@endsetup
@servers(['web' => ["$user@$ip -p $port"]])
@task('deploy', ['on' => 'web'])
cd {{ $path }}
git pull origin {{ $branch }}
composer install --no-dev --optimize-autoloader
php artisan bjyblog:update
@endtask