From a6527d822b5f81d608048ee54aeedb513ed76a45 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Thu, 6 Nov 2025 03:58:56 -0800 Subject: [PATCH] =?UTF-8?q?ci(workflow):=20=E6=9B=B4=E6=96=B0Windows?= =?UTF-8?q?=E6=9E=84=E5=BB=BA=E5=B7=A5=E4=BD=9C=E6=B5=81=E7=9A=84Git?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E6=A3=80=E6=B5=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 扩展Git可执行文件和路径的检测范围,包括32位程序目录 移除冗余的输出信息,简化脚本逻辑 --- .github/workflows/build-windows.yml | 32 ++++++++++++++++++----------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index 239ee3d..69a1a43 100755 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -83,25 +83,33 @@ jobs: run: | $paths = @( 'C:\Program Files\Git\cmd', - 'C:\Program Files\Git\bin' + 'C:\Program Files\Git\bin', + 'C:\Program Files (x86)\Git\cmd', + 'C:\Program Files (x86)\Git\bin' ) foreach ($p in $paths) { if (Test-Path $p) { - # Make available to subsequent steps Add-Content -Path $env:GITHUB_PATH -Value $p - # Also update current step PATH so we can verify immediately $env:PATH = "$p;$env:PATH" - Write-Host "✅ Added to PATH: $p" - } else { - Write-Host "⚠️ Path not found: $p" + Write-Host ("Added to PATH: {0}" -f $p) } } - # Verify Git using absolute path to avoid PATH propagation timing issues - $gitCmd = 'C:\Program Files\Git\cmd\git.exe' - if (Test-Path $gitCmd) { - & $gitCmd --version - } else { - Write-Host "ℹ️ Git executable not found at $gitCmd; continuing." + $candidates = @( + 'C:\Program Files\Git\cmd\git.exe', + 'C:\Program Files\Git\bin\git.exe', + 'C:\Program Files (x86)\Git\cmd\git.exe', + 'C:\Program Files (x86)\Git\bin\git.exe' + ) + $found = $false + foreach ($g in $candidates) { + if (Test-Path $g) { + & $g --version + $found = $true + break + } + } + if (-not $found) { + Write-Host "Git executable not found in common locations; continuing." } - name: 📥 Checkout 代码