ci(workflow): 在 Windows 构建流程中添加 Node.js 便携版安装
Some checks failed
Build Android APK / 编译 libcore.aar (push) Failing after 12s
Build Android APK / 编译 Android APK (release) (push) Has been skipped
Build Multi-Platform / 编译 libcore (iOS/tvOS) (push) Failing after 6s
Build Windows / 编译 libcore (Windows) (push) Failing after 5s
Build Windows / build (push) Has been skipped
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
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

新增 Node.js 便携版安装步骤,避免全局安装依赖
设置 job 级 PATH 确保所有步骤都能访问 Node.js
同时更新代码检出配置以包含子模块
This commit is contained in:
shanshanzhong 2025-11-05 18:33:00 -08:00
parent 7c9b23edbd
commit 4389770821

View File

@ -60,10 +60,41 @@ jobs:
build:
runs-on: windows-latest
needs: build-libcore
# 新增:设置 job 级 PATH让所有 steps 都能访问 Node.js
env:
PATH: ${{ github.workspace }}\node;${{ env.PATH }}
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
with:
submodules: recursive
fetch-depth: 0
- name: 📥 下载 libcore
uses: actions/download-artifact@v4