fix(ci): macOS 打包改用 ditto 保留 symlink 和文件权限,修复解压失败

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-06-08 22:51:18 +08:00
parent b0a74f3607
commit 65d6b12a21
+5 -15
View File
@@ -22,22 +22,12 @@ flutter build macos --release \
cd ..
# Package .app bundle into zip
# ditto preserves symlinks, Unix permissions, and extended attributes (code-signing).
# Python's zipfile follows symlinks and drops permissions — do NOT use it for .app bundles.
mkdir -p dist
python3 - <<'PYEOF'
import zipfile, os
src = os.path.join('client', 'build', 'macos', 'Build', 'Products', 'Release', 'jiu.app')
dst = os.path.join('dist', 'jiu-macos-x64.zip')
with zipfile.ZipFile(dst, 'w', zipfile.ZIP_DEFLATED) as zf:
for root, dirs, files in os.walk(src):
for fname in files:
fp = os.path.join(root, fname)
zf.write(fp, os.path.join('jiu.app', os.path.relpath(fp, src)))
size = os.path.getsize(dst)
print(f'Packaged {dst} ({size // 1024 // 1024} MB)')
PYEOF
APP_SRC="client/build/macos/Build/Products/Release/jiu.app"
ditto -c -k --keepParent "${APP_SRC}" dist/jiu-macos-x64.zip
echo "Packaged dist/jiu-macos-x64.zip ($(du -sh dist/jiu-macos-x64.zip | cut -f1))"
echo "==> compile-macos: done — dist/ contents:"
ls -lh dist/