fix(ci): 前端构建改用 npm——core 为独立包无需 pnpm 工作区,绕开 runner 安装 pnpm 失败
Build and Publish Commercial Web / build (push) Failing after 3m10s
Build and Publish Commercial Web / build (push) Failing after 3m10s
This commit is contained in:
@@ -105,38 +105,6 @@ jobs:
|
||||
fi
|
||||
echo "PATH=$TOOLDIR/node/bin:$PATH" >> "$GITEA_ENV"
|
||||
|
||||
- name: Install pnpm
|
||||
run: |
|
||||
export HOME="$RUNNER_WORKSPACE"
|
||||
# pnpm 随工具链缓存;linuxstatic 单文件二进制不依赖 npm registry
|
||||
# 且同时兼容 glibc/musl runner(npm install -g 在多个 runner 上不稳定)
|
||||
TOOLDIR="$RUNNER_WORKSPACE/.lunar-toolchain"
|
||||
mkdir -p "$TOOLDIR/pnpm/bin"
|
||||
PNPM_VER=11.13.1
|
||||
if [ ! -x "$TOOLDIR/pnpm/bin/pnpm" ]; then
|
||||
DL_OK=""
|
||||
for url in \
|
||||
"https://registry.npmmirror.com/-/binary/pnpm/v$PNPM_VER/pnpm-linuxstatic-x64" \
|
||||
"https://github.com/pnpm/pnpm/releases/download/v$PNPM_VER/pnpm-linuxstatic-x64"; do
|
||||
echo "尝试下载: $url"
|
||||
if wget -q -t 2 -T 60 -O "$TOOLDIR/pnpm/bin/pnpm" "$url"; then
|
||||
chmod +x "$TOOLDIR/pnpm/bin/pnpm"
|
||||
if "$TOOLDIR/pnpm/bin/pnpm" --version >/dev/null 2>&1; then
|
||||
DL_OK=1
|
||||
echo "下载成功"
|
||||
break
|
||||
fi
|
||||
echo "二进制无法执行,尝试下一源"
|
||||
else
|
||||
echo "下载失败,尝试下一源"
|
||||
fi
|
||||
rm -f "$TOOLDIR/pnpm/bin/pnpm"
|
||||
done
|
||||
test -n "$DL_OK" || { echo "::error::pnpm 所有下载源均失败"; exit 1; }
|
||||
fi
|
||||
echo "PATH=$TOOLDIR/pnpm/bin:$PATH" >> "$GITEA_ENV"
|
||||
"$TOOLDIR/pnpm/bin/pnpm" --version
|
||||
|
||||
- name: Run Go tests
|
||||
working-directory: server
|
||||
run: |
|
||||
@@ -151,14 +119,16 @@ jobs:
|
||||
CI: "true"
|
||||
run: |
|
||||
export HOME="$RUNNER_WORKSPACE"
|
||||
# 用户级 npmrc:pnpm install 依赖下载走镜像源(lockfile 校验不受影响)
|
||||
# 依赖下载走 npmmirror;npm/pnpm 全局限定在部分 runner 不稳定,
|
||||
# 故不使用 pnpm 工作区——core 是独立包,npm install 即可构建
|
||||
npm config set registry https://registry.npmmirror.com || true
|
||||
# web/ 工作区:装依赖并构建 @lunar/core(web-commercial 的 file: 依赖)
|
||||
cd web
|
||||
pnpm install --frozen-lockfile
|
||||
pnpm --filter @lunar/core build
|
||||
cd ../web-commercial
|
||||
pnpm install --frozen-lockfile
|
||||
# @lunar/core:web-commercial 的 file: 依赖与 vite/tsconfig 别名目标
|
||||
cd web/packages/core
|
||||
npm install
|
||||
npx tsup
|
||||
test -f dist/index.js
|
||||
cd ../../../web-commercial
|
||||
npm install
|
||||
npx tsc -b
|
||||
npx vite build
|
||||
test -f dist/index.html
|
||||
|
||||
Reference in New Issue
Block a user