fix(ci): fix Node.js ARM64 musl build - use apk mode instead of cross

- V2 build now uses Alpine nodejs-current package (v23.x)
- V1 build now uses Alpine nodejs LTS package (v22.x)
- Add PKG_TYPE environment variable to select package type
- Update release notes to reflect new build approach

The cross-compilation mode failed because Node.js official glibc binary
cannot be converted to musl via patchelf due to glibc-specific dynamic
linker dependencies.
This commit is contained in:
10000ge10000
2026-03-17 02:30:34 +08:00
parent 1df1a4170b
commit 9d0012629b
2 changed files with 22 additions and 10 deletions

View File

@@ -34,16 +34,17 @@ jobs:
with: with:
platforms: linux/arm64 platforms: linux/arm64
- name: Build Node.js V1 ARM64 musl (apk mode) - name: Build Node.js V1 ARM64 musl (apk lts mode)
run: | run: |
NODE_VER="22.15.1" NODE_VER="22.15.1"
mkdir -p dist mkdir -p dist
echo "=== Building Node.js v${NODE_VER} ARM64 musl (apk mode) ===" echo "=== Building Node.js v${NODE_VER} ARM64 musl (apk lts mode) ==="
docker run --rm --platform linux/arm64 \ docker run --rm --platform linux/arm64 \
-v "$PWD/dist:/output" \ -v "$PWD/dist:/output" \
-v "$PWD/scripts/build-node-musl.sh:/build-node-musl.sh:ro" \ -v "$PWD/scripts/build-node-musl.sh:/build-node-musl.sh:ro" \
-e "NODE_VER=${NODE_VER}" \ -e "NODE_VER=${NODE_VER}" \
-e "BUILD_MODE=apk" \ -e "BUILD_MODE=apk" \
-e "PKG_TYPE=lts" \
alpine:3.21 sh /build-node-musl.sh alpine:3.21 sh /build-node-musl.sh
- name: Build info - name: Build info
@@ -86,16 +87,17 @@ jobs:
with: with:
platforms: linux/arm64 platforms: linux/arm64
- name: Build Node.js V2 ARM64 musl (cross mode) - name: Build Node.js V2 ARM64 musl (apk current mode)
run: | run: |
NODE_VER="22.16.0" NODE_VER="22.16.0"
mkdir -p dist mkdir -p dist
echo "=== Building Node.js v${NODE_VER} ARM64 musl (cross mode) ===" echo "=== Building Node.js v${NODE_VER}+ ARM64 musl (apk current mode) ==="
docker run --rm --platform linux/arm64 \ docker run --rm --platform linux/arm64 \
-v "$PWD/dist:/output" \ -v "$PWD/dist:/output" \
-v "$PWD/scripts/build-node-musl.sh:/build-node-musl.sh:ro" \ -v "$PWD/scripts/build-node-musl.sh:/build-node-musl.sh:ro" \
-e "NODE_VER=${NODE_VER}" \ -e "NODE_VER=${NODE_VER}" \
-e "BUILD_MODE=cross" \ -e "BUILD_MODE=apk" \
-e "PKG_TYPE=current" \
alpine:3.21 sh /build-node-musl.sh alpine:3.21 sh /build-node-musl.sh
- name: Build info - name: Build info
@@ -167,12 +169,13 @@ jobs:
| 文件 | 版本 | 用途 | | 文件 | 版本 | 用途 |
|------|------|------| |------|------|------|
| `node-v22.16.0-linux-arm64-musl.tar.xz` | V2 (当前) | OpenClaw v2026.3.11+ (要求 >= 22.16.0) | | `node-v23.x.x-linux-arm64-musl.tar.xz` | V2 (当前) | OpenClaw v2026.3.11+ (要求 >= 22.16.0) |
| `node-v22.15.1-linux-arm64-musl.tar.xz` | V1 (旧版) | OpenClaw v2026.3.8 及更早版本 | | `node-v22.x.x-linux-arm64-musl.tar.xz` | V1 (旧版) | OpenClaw v2026.3.8 及更早版本 |
## 构建模式 ## 构建模式
- **V2 (22.16.0)**: 交叉编译模式,从 Node.js 官方 glibc 版本转换为 musl 两种版本均使用 **Alpine apk 模式** 构建:
- **V1 (22.15.1)**: Alpine apk 模式,使用 Alpine 仓库的 Node.js - **V2**: 使用 Alpine `nodejs-current` 包 (v23.x),满足 OpenClaw >= 22.16.0 的要求
- **V1**: 使用 Alpine `nodejs` LTS 包 (v22.x),兼容旧版 OpenClaw
`openclaw-env setup` 会在 ARM64 musl 设备上自动从此处下载合适的版本。 `openclaw-env setup` 会在 ARM64 musl 设备上自动从此处下载合适的版本。

View File

@@ -26,10 +26,19 @@ echo " Target version: v${NODE_VER}"
echo " Build mode: ${BUILD_MODE}" echo " Build mode: ${BUILD_MODE}"
# ── apk 模式: 使用 Alpine 仓库的 Node.js ── # ── apk 模式: 使用 Alpine 仓库的 Node.js ──
# PKG_TYPE: lts (nodejs) 或 current (nodejs-current)
build_apk() { build_apk() {
echo "" echo ""
echo "=== Building with Alpine apk mode ===" echo "=== Building with Alpine apk mode ==="
# 根据请求的版本选择包
if [ "${PKG_TYPE}" = "current" ]; then
echo "Using nodejs-current package for newer version"
apk add --no-cache nodejs-current npm xz icu-data-full patchelf
else
echo "Using nodejs (LTS) package"
apk add --no-cache nodejs npm xz icu-data-full patchelf apk add --no-cache nodejs npm xz icu-data-full patchelf
fi
ACTUAL_VER=$(node --version | sed 's/^v//') ACTUAL_VER=$(node --version | sed 's/^v//')
echo "Alpine Node.js version: v${ACTUAL_VER} (requested: v${NODE_VER})" echo "Alpine Node.js version: v${ACTUAL_VER} (requested: v${NODE_VER})"