Files
jiu/scripts/ci/compile-macos.sh
T
wangjia b43601b4fd
Deploy / build-windows (push) Failing after 25s
Deploy / build-macos (push) Has been cancelled
Deploy / release-deploy (push) Has been cancelled
Deploy / build-linux-web (push) Has been cancelled
ci: 运行环境自愈预置 + 发版任务串行 + 删 ci.yml/暂停备份
- 新增 scripts/ci/provision-{mac,windows}.sh:幂等预置,按 Flutter 版本
  stamp 短路,pipeline 首跑自动 precache + 预热缓存,运行时不再下载 engine
- scripts/ci/_env.sh:抽出共用镜像 env,compile 脚本统一 source
- deploy.yml:build-macos needs build-linux-web,同一 mac runner 串行
  执行,避免排队超时;各 build job 加 Provision 前置步骤
- 删除 .gitea/workflows/ci.yml
- backup.yml:暂停定时备份(保留 workflow_dispatch 手动触发)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-03 01:04:23 +08:00

44 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# compile-macos.sh <tag> — build Flutter macOS desktop, package into dist/
set -euo pipefail
# shellcheck source=scripts/ci/_env.sh
. "$(dirname "$0")/_env.sh"
TAG="$1"
VER="${TAG#v}"
echo "==> compile-macos: version=${VER}"
# Sync Flutter pubspec version (BSD sed on macOS)
sed -i '' "s/^version:.*/version: ${VER}+1/" client/pubspec.yaml
# Build Flutter macOS
cd client
flutter build macos --release \
"--dart-define=BASE_URL=https://jiu.51yanmei.com" \
"--dart-define=PUBLIC_URL=https://jiu.51yanmei.com" \
"--dart-define=APP_VERSION=${TAG}"
cd ..
# Package .app bundle into zip
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
echo "==> compile-macos: done — dist/ contents:"
ls -lh dist/