fix(dist): Linux 包打不出 tar.gz —— 交付目录不再由 staging 顺带创建

1.3.0 把服务端组装中间物从 `releases/server/<版本>/linux-x64/classhelper-server-linux-x64/`
挪进 `.cache/server-staging/` 之后,`releases/server/<版本>/linux-x64/` 就再没有谁创建它了 ——
`tar -czf <那里>/classhelper-server-linux-x64-<版本>.tar.gz` 直接以
`tar (child): ...tar.gz: Cannot open: No such file or directory` 退出码 2 失败。

Windows 侧不受影响(`buildInstaller()` 里有 `mkdirSync(INSTALLER_DIR)`),
所以本地 `pnpm dist:server` 永远踩不到;`release-linux-server.yml` 在 v1.3.0 的 tag 上一跑就红
(run 38109984623 挂在「构建 Linux 安装包」)。补救是幂等的:目录已存在就什么也不做。

`packLinuxTarball()` 的 tar 调用与 1.2.0 逐字节相同,而 1.2.0 的 CI(run 37458412997)是绿的
—— 唯一的差异就是那句隐式创建没了。
This commit is contained in:
LoveChengke committed 2026-10-11 14:17:37 +08:00
1 parent 817af02357
commit 966c8f9b5d
2 files changed
+13

No files matched your search

+5
View File
@@ -797,6 +797,11 @@ function packLinuxTarball() {
fs.rmSync(LINUX_TARBALL, { force: true });
const topDir = path.basename(staging); // tar 里套一层目录,安装器用 --strip-components=1 展开
log(`打包 ${path.relative(root, LINUX_TARBALL)} ...`);
// 交付目录**必须自己建**:staging 挪到 .cache/ 之后,`releases/server/<版本>/linux-x64/`
// 不再是谁的父目录,没有这一句 tar 会以
// `tar (child): ...tar.gz: Cannot open: No such file or directory` 退出码 2 直接失败
// (Windows 侧有 buildInstaller() 里的 mkdirSync(INSTALLER_DIR),Linux 侧原先靠 staging 顺带创建)。
fs.mkdirSync(path.dirname(LINUX_TARBALL), { recursive: true });
// GNU tar 在 Windows 路径上有两个坑(Linux 上路径没有盘符、没有反斜杠,永远踩不到,
// 只有交叉构建会碰到):
// ① `-f F:\...tar.gz` 里的**盘符冒号**会被当成 `主机:路径` 的远程归档写法,