1
0

Ask for confirmation before deploying

This commit is contained in:
Richard Dern 2024-05-03 16:16:19 +02:00
parent a3ee7d10a8
commit be6d443a13

View File

@ -8,6 +8,7 @@
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str; use Illuminate\Support\Str;
use function Laravel\Prompts\confirm;
use function Laravel\Prompts\progress; use function Laravel\Prompts\progress;
class Render extends Command class Render extends Command
@ -60,13 +61,15 @@ public function handle()
$progress->finish(); $progress->finish();
$this->output->write('Deploying... '); if (confirm('Ready to deploy?')) {
$source = Str::finish(Storage::disk(env('DIST_DISK'))->path('/'), '/'); $this->output->write('Deploying... ');
$target = env('DEPLOY_TARGET'); $source = Str::finish(Storage::disk(env('DIST_DISK'))->path('/'), '/');
$target = env('DEPLOY_TARGET');
$command = sprintf('rsync -az -L --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --chown=caddy:caddy --delete "%s" "%s"', $source, $target); $command = sprintf('rsync -az -L --chmod=Du=rwx,Dg=rx,Do=rx,Fu=rw,Fg=r,Fo=r --chown=caddy:caddy --delete "%s" "%s"', $source, $target);
Process::run($command)->throw(); Process::run($command)->throw();
$this->info('OK'); $this->info('OK');
}
} }
} }