提交 a437a915 authored 作者: 王鹏飞's avatar 王鹏飞

chore: 更新版本号至 1.2.0+10,并修改 iOS 发布脚本选项

上级 0eb942f3
......@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 1.1.0+9
version: 1.2.0+10
environment:
sdk: '>=3.0.0 <4.0.0'
......
......@@ -5,8 +5,8 @@ set -euo pipefail
#
# Default behavior:
# 1. Validate local release inputs.
# 2. Run flutter pub get and pod install.
# 3. Build an App Store IPA.
# 2. Reuse a matching IPA already under build/ios/ipa/.
# 3. Build an IPA only when no matching IPA exists.
# 4. Upload the IPA and wait for App Store Connect processing.
#
# Submit behavior:
......@@ -19,6 +19,7 @@ EXPORT_OPTIONS="$PROJECT_DIR/ios/ExportOptions.plist"
ASC_CONFIG="$PROJECT_DIR/.asc/config.json"
SUBMIT=false
SKIP_BUILD=false
REBUILD=false
SUBMIT_ONLY=false
TIMEOUT="45m"
......@@ -27,11 +28,13 @@ REVIEW_NOTES=$'App Review notes:\n\nIn-App Purchases can be found after logging
usage() {
cat <<EOF
Usage:
./scripts/ios_publish.sh [--submit] [--skip-build] [--submit-only] [--timeout 45m]
./scripts/ios_publish.sh [--submit] [--rebuild] [--upload-only] [--submit-only] [--timeout 45m]
Options:
--submit Submit the processed build for App Review after upload.
--skip-build Reuse an existing IPA under build/ios/ipa/.
--rebuild Force a new IPA build, even if a matching IPA already exists.
--upload-only Reuse an existing matching IPA; never run Flutter or CocoaPods.
--skip-build Alias for --upload-only.
--submit-only Update App Review notes and submit an already uploaded build.
--timeout Upload/build processing timeout passed to asc. Default: 45m.
-h, --help Show this help.
......@@ -48,6 +51,14 @@ while [[ $# -gt 0 ]]; do
SKIP_BUILD=true
shift
;;
--upload-only)
SKIP_BUILD=true
shift
;;
--rebuild)
REBUILD=true
shift
;;
--submit-only)
SUBMIT=true
SUBMIT_ONLY=true
......@@ -96,8 +107,6 @@ extract_json_id() {
cd "$PROJECT_DIR"
require_cmd flutter
require_cmd pod
require_cmd asc
require_cmd jq
......@@ -133,14 +142,47 @@ echo " Version: $VERSION"
echo " Build: $BUILD"
echo " Submit: $SUBMIT"
echo " Submit only: $SUBMIT_ONLY"
echo " Rebuild: $REBUILD"
echo "========================================="
echo "[0/5] Checking App Store Connect auth..."
asc doctor >/dev/null
if [[ "$SUBMIT_ONLY" == true ]]; then
echo "[1-4/5] Submit-only mode; skipping build and upload."
elif [[ "$SKIP_BUILD" != true ]]; then
IPA_DIR="$PROJECT_DIR/build/ios/ipa"
find_matching_ipa() {
local candidate entry info_plist ipa_version ipa_build
IPA_PATH=""
while IFS= read -r candidate; do
entry="$(unzip -Z1 "$candidate" | grep -E '^Payload/[^/]+\.app/Info\.plist$' | head -1 || true)"
[[ -n "$entry" ]] || continue
info_plist="$(mktemp "${TMPDIR:-/tmp}/ios-publish.XXXXXX")"
if ! unzip -p "$candidate" "$entry" > "$info_plist" 2>/dev/null; then
rm -f "$info_plist"
continue
fi
ipa_version="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleShortVersionString' "$info_plist" 2>/dev/null || true)"
ipa_build="$(/usr/libexec/PlistBuddy -c 'Print :CFBundleVersion' "$info_plist" 2>/dev/null || true)"
rm -f "$info_plist"
if [[ "$ipa_version" == "$VERSION" && "$ipa_build" == "$BUILD" ]]; then
if [[ -n "$IPA_PATH" ]]; then
echo "Multiple matching IPAs found under $IPA_DIR:" >&2
echo " $IPA_PATH" >&2
echo " $candidate" >&2
exit 1
fi
IPA_PATH="$candidate"
fi
done < <(find "$IPA_DIR" -maxdepth 1 -name '*.ipa' -type f -print | sort)
}
build_ipa() {
require_cmd flutter
require_cmd pod
echo "[1/5] Installing Flutter dependencies..."
flutter pub get
......@@ -150,18 +192,41 @@ elif [[ "$SKIP_BUILD" != true ]]; then
echo "[3/5] Building IPA..."
flutter build ipa --release --build-name="$VERSION" --build-number="$BUILD" \
--export-options-plist="$EXPORT_OPTIONS"
}
if [[ "$SUBMIT_ONLY" == true ]]; then
echo "[1-4/5] Submit-only mode; skipping build and upload."
else
echo "[1-3/5] Skipping build; reusing existing IPA."
if [[ "$REBUILD" == true && "$SKIP_BUILD" == true ]]; then
echo "--rebuild and --upload-only cannot be used together." >&2
exit 2
fi
if [[ "$REBUILD" == true ]]; then
build_ipa
else
find_matching_ipa
if [[ -n "$IPA_PATH" ]]; then
echo "[1-3/5] Reusing matching IPA; skipping build: $IPA_PATH"
elif [[ "$SKIP_BUILD" == true ]]; then
echo "No IPA for $VERSION ($BUILD) found under $IPA_DIR." >&2
echo "Build it first or omit --upload-only." >&2
exit 1
else
echo "No matching IPA found; building $VERSION ($BUILD)."
build_ipa
fi
fi
fi
if [[ "$SUBMIT_ONLY" != true ]]; then
mapfile -t IPA_FILES < <(find "$PROJECT_DIR/build/ios/ipa" -maxdepth 1 -name '*.ipa' -type f -print | sort)
if [[ "${#IPA_FILES[@]}" -ne 1 ]]; then
echo "Expected exactly one IPA under build/ios/ipa, found ${#IPA_FILES[@]}:" >&2
printf ' %s\n' "${IPA_FILES[@]}" >&2
if [[ -z "$IPA_PATH" ]]; then
find_matching_ipa
fi
if [[ -z "$IPA_PATH" ]]; then
echo "No IPA for $VERSION ($BUILD) found under $IPA_DIR." >&2
exit 1
fi
IPA_PATH="${IPA_FILES[0]}"
echo "IPA: $IPA_PATH"
echo "[4/5] Uploading IPA and waiting for processing..."
......@@ -171,7 +236,7 @@ if [[ "$SUBMIT_ONLY" != true ]]; then
--version "$VERSION" \
--build-number "$BUILD" \
--wait \
--verify-timeout 5m
--verify-timeout "$TIMEOUT"
fi
if [[ "$SUBMIT" != true ]]; then
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论