部署脚本修改

This commit is contained in:
谢宇宁
2026-11-07 20:11:51 +07:00
parent b20c81f55b
commit be1e6b2f26
7 changed files with 28 additions and 3 deletions
+4 -2
View File
@@ -30,8 +30,10 @@ LINUX_DIST="$DIR/dist/production-linux-x64-glibc"
echo "[3/5] 生成 tar.gz 和 SHA-256..."
# 从 dist/production-linux-x64-glibc/ 下进入打 tar,避免外层目录名出现在压缩包里;up_next_h5_prod.sh 预期入口在根(start.mjs 等)。
# --no-xattrs 去 macOS 扩展属性噪音;包含 Linux sharp 原生 .node,远端无需 npm ci。
(cd "$LINUX_DIST" && tar --no-xattrs --exclude='.DS_Store' --exclude='node_modules/@img/sharp-darwin-arm64' --exclude='node_modules/@img/sharp-libvips-darwin-arm64' -czf "$STAGE/$PACKAGE_NAME" --owner=0 --group=0 .)
# -h 把 pnpm 的符号链接展开成真实文件(远端只接受普通文件和目录);--no-xattrs 去 macOS 扩展属性噪音;包含 Linux sharp 原生 .node,远端无需 npm ci。
# 属主归零:GNU tar 用 --owner/--group,macOS 自带 bsdtar 用 --uid/--gid。
if tar --version 2>/dev/null | grep -q 'GNU tar'; then OWNER_OPTS=(--owner=0 --group=0); else OWNER_OPTS=(--uid 0 --gid 0); fi
(cd "$LINUX_DIST" && tar -h --no-xattrs --exclude='.DS_Store' --exclude='*sharp-darwin-arm64*' --exclude='*sharp-libvips-darwin-arm64*' "${OWNER_OPTS[@]}" -czf "$STAGE/$PACKAGE_NAME" .)
(cd "$STAGE" && shasum -a 256 "$PACKAGE_NAME" > "$PACKAGE_NAME.sha256")
ls -lh "$STAGE/$PACKAGE_NAME" "$STAGE/$PACKAGE_NAME.sha256"