feat: 在部署脚本中添加src目录上传功能

This commit is contained in:
dmy
2026-01-13 19:01:50 +08:00
parent 333748a6b9
commit 894976e680

View File

@@ -7,6 +7,7 @@ $remoteUser = "cubie"
$keyPath = "d:\163" $keyPath = "d:\163"
$serverDest = "/home/cubie/down/document/bidding/publish/server" $serverDest = "/home/cubie/down/document/bidding/publish/server"
$frontendDest = "/home/cubie/down/document/bidding/publish/" $frontendDest = "/home/cubie/down/document/bidding/publish/"
$srcDest = "/home/cubie/down/document/bidding/"
# Check if key file exists # Check if key file exists
if (-not (Test-Path $keyPath)) { if (-not (Test-Path $keyPath)) {
@@ -26,6 +27,12 @@ if (-not (Test-Path "frontend")) {
exit 1 exit 1
} }
# Check if src directory exists
if (-not (Test-Path "src")) {
Write-Error "src directory not found"
exit 1
}
Write-Host "Starting deployment..." -ForegroundColor Green Write-Host "Starting deployment..." -ForegroundColor Green
Write-Host "Remote server: ${remoteHost}:${remotePort}" -ForegroundColor Cyan Write-Host "Remote server: ${remoteHost}:${remotePort}" -ForegroundColor Cyan
Write-Host "Private key: $keyPath" -ForegroundColor Cyan Write-Host "Private key: $keyPath" -ForegroundColor Cyan
@@ -52,4 +59,15 @@ if ($LASTEXITCODE -ne 0) {
Write-Host "frontend directory uploaded successfully" -ForegroundColor Green Write-Host "frontend directory uploaded successfully" -ForegroundColor Green
# Upload entire src directory to bidding directory
Write-Host "`nUploading src directory to ${srcDest}..." -ForegroundColor Yellow
scp -i $keyPath -P $remotePort -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -r src "${remoteUser}@${remoteHost}:${srcDest}"
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to upload src directory"
exit 1
}
Write-Host "src directory uploaded successfully" -ForegroundColor Green
Write-Host "`nDeployment completed!" -ForegroundColor Green Write-Host "`nDeployment completed!" -ForegroundColor Green