From d9aebe2be2e61b9040ed12c6a311abafb5ac7cb3 Mon Sep 17 00:00:00 2001 From: tristan Date: Mon, 6 Apr 2026 15:22:29 +0200 Subject: [PATCH] feat : add DeployService for executing deploy scripts --- src/Service/DeployService.php | 41 +++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 src/Service/DeployService.php diff --git a/src/Service/DeployService.php b/src/Service/DeployService.php new file mode 100644 index 0000000..f53b5ad --- /dev/null +++ b/src/Service/DeployService.php @@ -0,0 +1,41 @@ +getDeployScriptPath(); + + if (null === $scriptPath || !file_exists($scriptPath)) { + return [ + 'success' => false, + 'output' => sprintf('Deploy script not found: %s', $scriptPath ?? 'null'), + 'exitCode' => 1, + ]; + } + + $process = new Process( + ['bash', $scriptPath, $tag], + dirname($scriptPath), + ); + $process->setTimeout(300); + + $process->run(); + + return [ + 'success' => $process->isSuccessful(), + 'output' => $process->getOutput() . $process->getErrorOutput(), + 'exitCode' => $process->getExitCode() ?? 1, + ]; + } +}