From e566ef4a51ee1c8a509526b4c47b8d6969278032 Mon Sep 17 00:00:00 2001 From: ginnoir Date: Mon, 8 Jun 2026 21:24:00 -0500 Subject: [PATCH] fix: deploy site archive as file --- scripts/deploy-site.ps1 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scripts/deploy-site.ps1 b/scripts/deploy-site.ps1 index b1596ae..2286a37 100644 --- a/scripts/deploy-site.ps1 +++ b/scripts/deploy-site.ps1 @@ -4,8 +4,10 @@ param( ) $ErrorActionPreference = "Stop" +$PSNativeCommandUseErrorActionPreference = $true $RepoRoot = Split-Path -Parent (Split-Path -Parent $MyInvocation.MyCommand.Path) $Dist = Join-Path $RepoRoot "dist" +$Archive = Join-Path $env:TEMP "romhack-archive-dist.tar" if (-not (Test-Path $Dist)) { throw "dist/ does not exist. Run npm run build first." @@ -15,11 +17,16 @@ if ([string]::IsNullOrWhiteSpace($RemotePath) -or -not $RemotePath.StartsWith("/ throw "RemotePath must be under /config/caddy/site/." } -Write-Host "Preparing remote site directory $RemotePath ..." -ssh $Server "rm -rf '$RemotePath' && mkdir -p '$RemotePath'" +if (Test-Path $Archive) { + Remove-Item -LiteralPath $Archive -Force +} + +Write-Host "Packing built site ..." +tar -C $Dist -cf $Archive . Write-Host "Syncing built site to ${Server}:$RemotePath ..." -tar -C $Dist -cf - . | ssh $Server "tar -C '$RemotePath' -xf -" +scp $Archive "${Server}:/tmp/romhack-archive-dist.tar" +ssh $Server "rm -rf '$RemotePath' && mkdir -p '$RemotePath' && tar -C '$RemotePath' -xf /tmp/romhack-archive-dist.tar && rm /tmp/romhack-archive-dist.tar" Write-Host "Reloading Caddy ..." ssh $Server "docker exec caddy caddy reload --config /etc/caddy/Caddyfile"