Envoy.blade.php 887 B

123456789101112131415161718192021222324252627
  1. @setup
  2. require __DIR__.'/vendor/autoload.php';
  3. $dotenv = Dotenv\Dotenv::create(Illuminate\Support\Env::getRepository(), __DIR__);
  4. try {
  5. $dotenv->load();
  6. $dotenv->required(['DEPLOY_IP', 'DEPLOY_PORT', 'DEPLOY_USER', 'DEPLOY_PATH', 'DEPLOY_BRANCH'])->notEmpty();
  7. } catch ( Exception $e ) {
  8. echo $e->getMessage();
  9. }
  10. $ip = getenv('DEPLOY_IP');
  11. $port = getenv('DEPLOY_PORT');
  12. $user = getenv('DEPLOY_USER');
  13. $path = getenv('DEPLOY_PATH');
  14. $branch = getenv('DEPLOY_BRANCH');
  15. if ( substr($path, 0, 1) !== '/' ) throw new Exception('Must be an absolute path');
  16. $path = rtrim($path, '/');
  17. @endsetup
  18. @servers(['web' => ["$user@$ip -p $port"]])
  19. @task('deploy', ['on' => 'web'])
  20. cd {{ $path }}
  21. git pull origin {{ $branch }}
  22. composer install --no-dev --optimize-autoloader
  23. php artisan bjyblog:update
  24. @endtask