From 80baba46ff7c864695c315664ec22658e9fe158d Mon Sep 17 00:00:00 2001 From: Christ Date: Wed, 12 Aug 2026 02:17:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20macOS=20runtime=20?= =?UTF-8?q?=E6=89=A7=E8=A1=8C=E6=9D=83=E9=99=90=E4=B8=8E=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E5=8C=85=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在 pkgbuild 前将 Playwright Node、Chromium 及其他 Mach-O 文件统一设置为 0755,避免安装后普通用户启动服务时出现 permission denied。 - 将 macOS arm64 与 amd64 安装包分别上传为独立 Artifact,避免用户下载包含另一架构的无用文件。 --- .github/workflows/desktop-cd.yml | 13 ++++++++++--- packaging/macos/build-pkg.sh | 15 +++++++++++++-- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/.github/workflows/desktop-cd.yml b/.github/workflows/desktop-cd.yml index a4ab856..ac16c8f 100644 --- a/.github/workflows/desktop-cd.yml +++ b/.github/workflows/desktop-cd.yml @@ -294,9 +294,16 @@ jobs: packaging/macos/build-pkg.sh "$APP_VERSION" "$PWD/dist/macos" "$arch" done - - name: 上传 macOS 安装包 + - name: 上传 macOS arm64 安装包 uses: actions/upload-artifact@v7 with: - name: ydisks-xianyu-helper-macos-${{ env.APP_VERSION }} - path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-*.pkg + name: ydisks-xianyu-helper-macos-arm64-${{ env.APP_VERSION }} + path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-arm64.pkg + if-no-files-found: error + + - name: 上传 macOS amd64 安装包 + uses: actions/upload-artifact@v7 + with: + name: ydisks-xianyu-helper-macos-amd64-${{ env.APP_VERSION }} + path: dist/macos/Ydisks-Xianyu-Helper-${{ env.APP_VERSION }}-amd64.pkg if-no-files-found: error diff --git a/packaging/macos/build-pkg.sh b/packaging/macos/build-pkg.sh index 4ddd625..45bc63d 100755 --- a/packaging/macos/build-pkg.sh +++ b/packaging/macos/build-pkg.sh @@ -42,6 +42,18 @@ cp "$PROJECT_ROOT/icon/macos/icon.icns" "$APP/Contents/Resources/icon.icns" sed "s/__VERSION__/$VERSION/g" "$SCRIPT_DIR/Info.plist" > "$APP/Contents/Info.plist" chmod 0755 "$APP/Contents/MacOS/Ydisks闲鱼助手" "$APP/Contents/Helpers/xianyu-server" "$APP_DIR/卸载 Ydisks闲鱼助手.command" +# pkgbuild 会保留 runtime 文件的原始权限;Playwright 下载的 Node 和 +# Chromium Mach-O 可能只有所有者可执行。安装包由 root 安装后,普通用户 +# 启动 LaunchAgent 时会因 permission denied 无法执行,因此统一授予执行权限。 +runtime_files="$(mktemp)" +trap 'rm -f "$runtime_files"' EXIT +find "$APP/Contents/Resources/playwright-runtime" -type f -print > "$runtime_files" +while IFS= read -r runtime_file; do + if file "$runtime_file" | grep -q 'Mach-O'; then + chmod 0755 "$runtime_file" + fi +done < "$runtime_files" + if [ -n "${MACOS_SIGNING_IDENTITY:-}" ]; then sign_code() { target="$1" @@ -69,8 +81,7 @@ if [ -n "${MACOS_SIGNING_IDENTITY:-}" ]; then # Playwright runtime 中包含独立 Node 和 Chromium.app。bundle 主程序不能 # 提前作为单个 Mach-O 签名,否则 codesign 会先校验尚未签名的内层 Framework。 # 因此这里只签 bundle 外的独立 Mach-O,再按目录深度递归签名所有 bundle。 - signing_list="$(mktemp)" - trap 'rm -f "$signing_list"' EXIT + signing_list="$runtime_files" find "$APP/Contents/Resources/playwright-runtime" -type f -print > "$signing_list" while IFS= read -r executable; do