start.php

This commit is contained in:
wandoubaba 2023-07-04 13:49:23 +08:00
parent 8f71e14a27
commit 96295847cd

View File

@ -15,21 +15,22 @@ $worker->onConnect = function ($connection) {
echo "New connection\n";
};
$worker->onMessage = function(TcpConnection $connection, Request $data)
$worker->onMessage = function(TcpConnection $connection, Request $request)
{
$work_dir = isset($_ENV['WORK_DIR']) ? $_ENV['WORK_DIR'] : null;
$branch = isset($_ENV['BRANCH']) ? $_ENV['BRANCH'] : null;
var_dump($request->post());
if ($work_dir && $branch) {
chdir($work_dir);
exec("git fetch origin $branch");
exec("git reset --hard FETCH_HEAD");
// chdir($work_dir);
// exec("git fetch origin $branch");
// exec("git reset --hard FETCH_HEAD");
exec("yarn install");
exec("yarn build");
// exec("yarn install");
// exec("yarn build");
$connection->send("Deployment finished\n");
$connection->close();
// $connection->send("Deployment finished\n");
// $connection->close();
}
// 设置工作目录