ci(workflow): 移除 Windows 构建中的 Node.js 安装步骤并添加 runner 条件
Some checks failed
Build Android APK / 编译 libcore.aar (push) Failing after 9s
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Failing after 8s
Build Windows / 编译 libcore (Windows) (20.15.1) (push) Successful in 20m6s
Build Android APK / 编译 Android APK (release) (push) Has been skipped
Build Windows / build (push) Has been skipped
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 / 编译 libcore (Android) (push) Has been cancelled
Build Android APK / 创建 GitHub Release (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 / 创建 Release (push) Has been cancelled
Build Multi-Platform / 构建 iOS (push) Has been cancelled

This commit is contained in:
shanshanzhong 2025-11-06 00:32:10 -08:00
parent dbf6175ad9
commit d1e45f0254

View File

@ -74,35 +74,11 @@ jobs:
build:
runs-on: windows-latest
needs: build-libcore
# 新增:设置 job 级 PATH让所有 steps 都能访问 Node.js
env:
PATH: ${{ github.workspace }}\node;${{ env.PATH }}
if: ${{ runner.os == 'Windows' }}
# 仅在真实 Windows runner 上执行此构建
steps:
# 新增:引导步骤,下载并设置 Node.js便携版无需全局安装
- name: 🔧 Setup Node.js
shell: pwsh
run: |
$nodeVersion = "22.9.0" # 可调整为其他 LTS 版本,如 "20.17.0"
$zipUrl = "https://nodejs.org/dist/v${nodeVersion}/node-v${nodeVersion}-win-x64.zip"
$zipPath = Join-Path $env:GITHUB_WORKSPACE "node.zip"
$nodeDir = Join-Path $env:GITHUB_WORKSPACE "node"
# 创建目录
New-Item -ItemType Directory -Force -Path $nodeDir | Out-Null
# 下载 ZIP
Write-Host "Downloading Node.js from $zipUrl"
Invoke-WebRequest -Uri $zipUrl -OutFile $zipPath
# 解压
Expand-Archive -Path $zipPath -DestinationPath $nodeDir -Force
Remove-Item $zipPath
# 验证(此时 PATH 已包含 $nodeDir所以能直接调用
Write-Host "Node.js version: $(& "$nodeDir\node.exe" --version)"
Write-Host "npm version: $(& "$nodeDir\npm.cmd" --version)"
Write-Host "Node.js installed to: $nodeDir"
- name: 📥 Checkout 代码
uses: actions/checkout@v4