From f738ba9245ac7dc2134db88b01e0169fd10d3613 Mon Sep 17 00:00:00 2001 From: shanshanzhong Date: Thu, 6 Nov 2025 02:55:16 -0800 Subject: [PATCH] =?UTF-8?q?ci(workflow):=20=E5=9C=A8Windows=E6=9E=84?= =?UTF-8?q?=E5=BB=BA=E6=B5=81=E7=A8=8B=E4=B8=AD=E6=B7=BB=E5=8A=A0Git?= =?UTF-8?q?=E5=88=B0PATH?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 添加PowerShell步骤以将Git的可执行路径添加到系统PATH环境变量中,确保在Windows环境下可以正常使用git命令 --- .github/workflows/build-windows.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index f75775e..8153654 100755 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -77,6 +77,24 @@ jobs: steps: # 新增:引导步骤,下载并设置 Node.js(便携版,无需全局安装) + - name: 🔧 Add Git to PATH (Windows) + if: ${{ runner.os == 'Windows' }} + shell: powershell + run: | + $paths = @( + 'C:\Program Files\Git\cmd', + 'C:\Program Files\Git\bin' + ) + foreach ($p in $paths) { + if (Test-Path $p) { + Add-Content -Path $env:GITHUB_PATH -Value $p + Write-Host "✅ Added to PATH: $p" + } else { + Write-Host "⚠️ Path not found: $p" + } + } + git --version + - name: 📥 Checkout 代码 uses: actions/checkout@v4 with: