From 131a9f4c4c650c833d70cf823e7afdb5f304fdf0 Mon Sep 17 00:00:00 2001 From: WuYongJie Date: Wed, 15 Jul 2026 20:53:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9E=84=E5=BB=BA=E6=9C=BA?= =?UTF-8?q?=E5=8F=91=E5=B8=83=E8=84=9A=E6=9C=AC=E4=BC=A0=E8=BE=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/git-build-deploy.ps1 | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/git-build-deploy.ps1 b/scripts/git-build-deploy.ps1 index b79d469..9aa69d8 100644 --- a/scripts/git-build-deploy.ps1 +++ b/scripts/git-build-deploy.ps1 @@ -152,7 +152,23 @@ foreach ($entry in $replacements.GetEnumerator()) { $remoteScript = $remoteScript.Replace($entry.Key, $entry.Value) } -$remoteScript | ssh -o BatchMode=yes -o ConnectTimeout=10 $BuildServer 'bash -s' -if ($LASTEXITCODE -ne 0) { - throw "通知中心构建机发布失败,退出码: $LASTEXITCODE" +$localTemp = Join-Path ([System.IO.Path]::GetTempPath()) ("yyd-notification-deploy-{0}.sh" -f [guid]::NewGuid().ToString('N')) +$remoteTemp = "/tmp/$(Split-Path $localTemp -Leaf)" +try { + [System.IO.File]::WriteAllText( + $localTemp, + $remoteScript, + [System.Text.UTF8Encoding]::new($false) + ) + & scp -o BatchMode=yes -o ConnectTimeout=10 $localTemp "${BuildServer}:$remoteTemp" + if ($LASTEXITCODE -ne 0) { + throw "通知中心发布脚本上传失败,退出码: $LASTEXITCODE" + } + & ssh -o BatchMode=yes -o ConnectTimeout=10 $BuildServer "chmod 700 '$remoteTemp' && bash '$remoteTemp'; code=`$?; rm -f '$remoteTemp'; exit `$code" + if ($LASTEXITCODE -ne 0) { + throw "通知中心构建机发布失败,退出码: $LASTEXITCODE" + } +} +finally { + Remove-Item -LiteralPath $localTemp -Force -ErrorAction SilentlyContinue }