Files
jiu/scripts/local_test.sh
T
wangjia 824992fe6e devops: 备案通过回切 https 域名 + 流水线 Ali 单轨
- nginx-jiu-ali.conf:443 ssl+http2 正式入口(HSTS/XFO/nosniff 安全头、
  ACME webroot 续期通道、80→443 跳转);8443 明文过渡口拆除
- 客户端构建 URL 全量回切 https://jiu.51yanmei.com(compile×5/local_test/
  release-client/notify)
- 流水线去 EC2:deploy-client/site 单轨 Ali、manual 回滚与每日备份切 ali、
  seed/reset/debug-db 改容器内取密码(SEC-003,退役 DB_PASSWORD secret)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JJ1g8XV1YhhmHRzhwWEW7o
2026-07-03 09:58:30 +08:00

46 lines
1.5 KiB
Bash
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env bash
# local_test.sh — 本地编译一份「指向线上后端」的 macOS app 并启动,用于发版前自测。
#
# 用法:
# sh scripts/local_test.sh # 编译 + 启动
# sh scripts/local_test.sh --no-open # 只编译不启动
#
# 后端固定指向生产 https://jiu.51yanmei.com(与 CI compile-macos.sh 一致;
# 2026-07-03 备案通过已回切 https 域名)。
set -euo pipefail
export PATH="/opt/homebrew/bin:$PATH"
# 版本号:取最新 client-v* tag 的 patch+1,纯展示用,取不到则回退 0.0.0-dev。
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"
LATEST_TAG="$(git describe --tags --match 'client-v*' --abbrev=0 2>/dev/null || true)"
if [ -n "$LATEST_TAG" ]; then
BASE_VER="${LATEST_TAG#client-v}"
MAJOR_MINOR="${BASE_VER%.*}"
PATCH="${BASE_VER##*.}"
VER="${MAJOR_MINOR}.$((PATCH + 1))"
else
VER="0.0.0-dev"
fi
APP="client/build/macos/Build/Products/Release/jiu_client.app"
echo "==> 编译 macOS app(线上后端,版本 v${VER}"
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=v${VER}"
cd "$REPO_ROOT"
echo "==> 产物:$APP"
if [ "${1:-}" = "--no-open" ]; then
echo "==> 跳过启动(--no-open"
else
echo "==> 前台启动 app(终端附着日志,退出 app 才返回;Ctrl-C 可终止)"
exec "$APP/Contents/MacOS/jiu_client"
fi