From d9ae5f8c2b89805cce8b9f1cfaf6edd034150661 Mon Sep 17 00:00:00 2001 From: Vincent BOUQUET Date: Sat, 12 Apr 2025 22:00:12 +0200 Subject: [PATCH] fix deploy --- deploy.ps1 | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/deploy.ps1 b/deploy.ps1 index 4927715..06993b3 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -5,9 +5,14 @@ $remoteHost = "robe.vincent-bouquet.fr" $remotePath = "/var/www/html/public/reap" $port = 22 # Change this if your SSH server uses a different port -# Build the SCP command -$copyCommand = "scp -r -P ${port} `"${localFolder}`" ${remoteUser}@${remoteHost}:`"${remotePath}`"" +# Build the SCP commands +$sshCommand = "ssh -p ${port} ${remoteUser}@${remoteHost} 'mkdir -p `"${remotePath}`" && sudo rm -rf `"${remotePath}/*`"'" +$scpCommand = "scp -r -P ${port} `"${localFolder}`" ${remoteUser}@${remoteHost}:`"${remotePath}`"" + +# Execute SSH command to clean remote directory +Write-Host "Cleaning remote directory: $remotePath" +Invoke-Expression $sshCommand # Execute the command -Write-Host "Executing: $copyCommand" -Invoke-Expression $copyCommand \ No newline at end of file +Write-Host "Executing: $scpCommand" +Invoke-Expression $scpCommand \ No newline at end of file