mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 06:26:16 +00:00
refactoring (#116)
- refactoring architecture - fix incomplete ssh logs - code editor for scripts in the app - remove Jobs and SSHCommands
This commit is contained in:
@ -2,9 +2,11 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Actions\Site\Deploy;
|
||||
use App\Exceptions\SourceControlIsNotConnected;
|
||||
use App\Facades\Notifier;
|
||||
use App\Models\GitHook;
|
||||
use App\Models\ServerLog;
|
||||
use App\Notifications\SourceControlDisconnected;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@ -26,10 +28,16 @@ public function __invoke(Request $request)
|
||||
foreach ($gitHook->actions as $action) {
|
||||
if ($action == 'deploy') {
|
||||
try {
|
||||
$gitHook->site->deploy();
|
||||
app(Deploy::class)->run($gitHook->site);
|
||||
} catch (SourceControlIsNotConnected) {
|
||||
Notifier::send($gitHook->sourceControl, new SourceControlDisconnected($gitHook->sourceControl));
|
||||
} catch (Throwable $e) {
|
||||
ServerLog::log(
|
||||
$gitHook->site->server,
|
||||
'deploy-failed',
|
||||
$e->getMessage(),
|
||||
$gitHook->site
|
||||
);
|
||||
Log::error('git-hook-exception', (array) $e);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user