fix: preservar mee/blog/.well-known/design-system en deploy-webhook.php
This commit is contained in:
@@ -41,6 +41,23 @@ $publicHtml = '/home/hostingd/public_html';
|
|||||||
$projectSrc = '/root/opencode/development/hostingdelsur.net';
|
$projectSrc = '/root/opencode/development/hostingdelsur.net';
|
||||||
$srcForms = $projectSrc . '/src/forms';
|
$srcForms = $projectSrc . '/src/forms';
|
||||||
|
|
||||||
|
// Directorios/archivos que NO pertenecen al build de Astro y deben
|
||||||
|
// sobrevivir el wipe (mismo criterio que scripts/deploy.sh --exclude).
|
||||||
|
// Se mueven a un staging dir antes del rm -rf y se restauran después.
|
||||||
|
$preserve = ['mwp', 'mee', 'blog', 'design-system', '.well-known', '.smtp-credentials.json'];
|
||||||
|
$stagingDir = '/home/hostingd/.deploy-preserve-tmp';
|
||||||
|
|
||||||
|
$preserveOut = "rm -rf {$stagingDir} && mkdir -p {$stagingDir}";
|
||||||
|
foreach ($preserve as $item) {
|
||||||
|
$preserveOut .= " && [ -e {$publicHtml}/{$item} ] && mv {$publicHtml}/{$item} {$stagingDir}/{$item} || true";
|
||||||
|
}
|
||||||
|
|
||||||
|
$restoreOut = "";
|
||||||
|
foreach ($preserve as $item) {
|
||||||
|
$restoreOut .= "[ -e {$stagingDir}/{$item} ] && mv {$stagingDir}/{$item} {$publicHtml}/{$item} || true; ";
|
||||||
|
}
|
||||||
|
$restoreOut .= "rm -rf {$stagingDir}";
|
||||||
|
|
||||||
$commands = [
|
$commands = [
|
||||||
"cd {$projectDir} && git pull origin main 2>&1",
|
"cd {$projectDir} && git pull origin main 2>&1",
|
||||||
"cd {$projectDir} && npm install --production=false 2>&1",
|
"cd {$projectDir} && npm install --production=false 2>&1",
|
||||||
@@ -48,10 +65,10 @@ $commands = [
|
|||||||
"cp {$srcForms}/contact.php {$distDir}/api/contact.php 2>&1",
|
"cp {$srcForms}/contact.php {$distDir}/api/contact.php 2>&1",
|
||||||
"cp {$srcForms}/deploy-webhook.php {$distDir}/api/deploy-webhook.php 2>&1",
|
"cp {$srcForms}/deploy-webhook.php {$distDir}/api/deploy-webhook.php 2>&1",
|
||||||
"cp {$srcForms}/api-htaccess {$distDir}/api/.htaccess 2>&1",
|
"cp {$srcForms}/api-htaccess {$distDir}/api/.htaccess 2>&1",
|
||||||
|
"{$preserveOut} 2>&1",
|
||||||
"rm -rf {$publicHtml}/* {$publicHtml}/.[!.]* 2>&1; mkdir -p {$publicHtml}",
|
"rm -rf {$publicHtml}/* {$publicHtml}/.[!.]* 2>&1; mkdir -p {$publicHtml}",
|
||||||
"cp -r {$distDir}/* {$distDir}/.[!.]* {$publicHtml}/ 2>&1",
|
"cp -r {$distDir}/* {$distDir}/.[!.]* {$publicHtml}/ 2>&1",
|
||||||
"rm -rf {$publicHtml}/mwp 2>&1 || true",
|
"{$restoreOut} 2>&1",
|
||||||
"rm -f {$publicHtml}/.smtp-credentials.json 2>&1 || true",
|
|
||||||
];
|
];
|
||||||
|
|
||||||
foreach ($commands as $cmd) {
|
foreach ($commands as $cmd) {
|
||||||
|
|||||||
Reference in New Issue
Block a user