fix(deploy): -Commit 分支误展开 shell 变量,运维脚本装不上

This commit is contained in:
ali
2026-11-20 14:33:09 +08:00
parent 44231a4d04
commit 604a4e2870
+7 -5
View File
@@ -86,9 +86,11 @@ try {
& git push origin main & git push origin main
if ($LASTEXITCODE -ne 0) { throw 'git push 失败' } if ($LASTEXITCODE -ne 0) { throw 'git push 失败' }
Invoke-RemoteScript @" # 单引号 here-string:保留 shell 的 $1/$src/$dst,避免被 PowerShell 提前展开
Invoke-RemoteScript @'
set -euo pipefail set -euo pipefail
cd $RemoteRepo REPO=/home/ali/docker/tools/python/SceneMarshal
cd "$REPO"
git fetch --prune origin git fetch --prune origin
git reset --hard origin/main git reset --hard origin/main
echo '=== 远端 HEAD ===' echo '=== 远端 HEAD ==='
@@ -107,9 +109,9 @@ install_tool() {
echo "⚠️ 安装失败: $dst(需要免密 sudo)" echo "⚠️ 安装失败: $dst(需要免密 sudo)"
fi fi
} }
install_tool "$RemoteRepo/scripts/media-rename" /usr/local/bin/media-rename install_tool "$REPO/scripts/media-rename" /usr/local/bin/media-rename
install_tool "$RemoteRepo/scripts/media_archive.py" /usr/local/bin/media-archive install_tool "$REPO/scripts/media_archive.py" /usr/local/bin/media-archive
"@ '@
} }
else { else {
$tgz = Join-Path ([IO.Path]::GetTempPath()) 'SceneMarshal-sync.tgz' $tgz = Join-Path ([IO.Path]::GetTempPath()) 'SceneMarshal-sync.tgz'