fix: populate repoMap with all 6 website repos; remove dead __NOVACPX_VM__ branch; dedupe date() call

This commit is contained in:
2026-06-23 16:29:35 +00:00
parent 9435f5d189
commit 222ad7513c
+12 -17
View File
@@ -28,9 +28,9 @@ if (!hash_equals($expected, $sig)) {
exit;
}
$data = json_decode($payload, true);
$repo = $data['repository']['name'] ?? '';
$ref = $data['ref'] ?? '';
$data = json_decode($payload, true);
$repo = $data['repository']['name'] ?? '';
$ref = $data['ref'] ?? '';
$pusher = $data['pusher']['name'] ?? 'unknown';
// Only deploy on pushes to main
@@ -40,7 +40,13 @@ if ($ref !== 'refs/heads/main') {
}
$repoMap = [
'jarvis' => '/var/www/jarvis',
'tomtomgames' => '/home/tomtomgames.com/public_html',
'tomsjavajive' => '/home/tomsjavajive.com/public_html',
'epictravelexpeditions' => '/home/epictravelexpeditions.com/public_html',
'parkerslingshot' => '/home/epictravelexpeditions.com/parkerslingshot',
'parkerslingshotrentals' => '/home/parkerslingshotrentals.com/public_html',
'orbishosting' => '/home/orbishosting.com/public_html',
'orbis-hosting-portal' => '/home/orbis.orbishosting.com/public_html',
];
if (!isset($repoMap[$repo])) {
@@ -50,20 +56,9 @@ if (!isset($repoMap[$repo])) {
}
$path = $repoMap[$repo];
// NovaCPX lives on a private VM — the VM polls GitHub every minute via cron
// This webhook receipt confirms GitHub delivered the push notification
if ($path === '__NOVACPX_VM__') {
$commit = $data['after'] ?? 'HEAD';
$msg = "[" . date('Y-m-d H:i:s') . "] NovaCPX push by $pusher (commit: $commit) — VM will deploy within 1 min";
file_put_contents(DEPLOY_LOG, $msg . "\n", FILE_APPEND | LOCK_EX);
echo json_encode(['ok' => true, 'queued' => 'novacpx', 'commit' => $commit]);
exit;
}
$ts = date('Y-m-d H:i:s');
file_put_contents(DEPLOY_QUEUE, $path . "\n", FILE_APPEND | LOCK_EX);
$msg = "[" . date('Y-m-d H:i:s') . "] Queued deploy: $repo by $pusher -> $path";
file_put_contents(DEPLOY_LOG, $msg . "\n", FILE_APPEND | LOCK_EX);
file_put_contents(DEPLOY_LOG, "[$ts] Queued deploy: $repo by $pusher -> $path\n", FILE_APPEND | LOCK_EX);
echo json_encode(['ok' => true, 'queued' => $repo, 'path' => $path]);