ci(workflow): 更新Windows构建工作流的Git路径检测逻辑
Some checks failed
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Failing after 9s
Build Android APK / 编译 libcore.aar (push) Failing after 8s
Build Android APK / 编译 Android APK (release) (push) Has been skipped
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Successful in 19m37s
Build Windows / build (push) Failing after 7h0m11s
Build Android APK / 创建 GitHub Release (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Android) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Windows) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (macOS) (push) Has been cancelled
Build Multi-Platform / 编译 libcore (Linux) (push) Has been cancelled
Build Multi-Platform / 构建 Android APK (push) Has been cancelled
Build Multi-Platform / 构建 Windows (push) Has been cancelled
Build Multi-Platform / 构建 macOS (push) Has been cancelled
Build Multi-Platform / 构建 Linux (push) Has been cancelled
Build Multi-Platform / 创建 Release (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled

扩展Git可执行文件和路径的检测范围,包括32位程序目录
移除冗余的输出信息,简化脚本逻辑
This commit is contained in:
shanshanzhong 2025-11-06 03:58:56 -08:00
parent aac7d84602
commit a6527d822b

View File

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