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 代码