From 27b8128a1906504a212f89337edd11a4dbe0b14f Mon Sep 17 00:00:00 2001 From: Anatoliy Poloz Date: Fri, 6 Nov 2026 12:26:36 +0300 Subject: [PATCH] fix(ci): build number --- ios/fastlane/Fastfile | 35 +++++++++++++++++++++++++++++++++++ pubspec.yaml | 2 +- 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 64898665..32931c09 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -82,6 +82,41 @@ platform :ios do UI.message "Flutter version from pubspec: #{flutter_build_name} (#{flutter_build_number})" + # Apple closes a version train once that version is approved/released. + # Uploading into a closed train wastes a full ~8 min build and fails only + # at the upload step with altool 90186 ("closed for new build submissions") + # / 90062 ("must be higher than the previously approved version"). + # Fail fast here, before building. + closed_train_states = [ + Spaceship::ConnectAPI::AppStoreVersion::AppVersionState::READY_FOR_DISTRIBUTION, + Spaceship::ConnectAPI::AppStoreVersion::AppVersionState::PROCESSING_FOR_DISTRIBUTION, + Spaceship::ConnectAPI::AppStoreVersion::AppVersionState::PENDING_DEVELOPER_RELEASE, + Spaceship::ConnectAPI::AppStoreVersion::AppVersionState::PENDING_APPLE_RELEASE + ].join(",") + asc_app = Spaceship::ConnectAPI::App.find("com.eatvioapp.app") + closed_train = nil + if asc_app.nil? + UI.important("App com.eatvioapp.app not found in App Store Connect, skipping closed-train guard") + else + closed_train = asc_app.get_app_store_versions( + filter: { + appVersionState: closed_train_states, + platform: Spaceship::ConnectAPI::Platform::IOS + } + ).find do |v| + (Gem::Version.new(v.version_string) >= Gem::Version.new(flutter_build_name)) + rescue ArgumentError + false + end + end + if closed_train + UI.user_error!( + "Version train #{closed_train.version_string} is closed for new submissions " \ + "(#{closed_train.app_version_state}), pubspec version is #{flutter_build_name}. " \ + "Bump the version in pubspec.yaml above #{closed_train.version_string} and re-run." + ) + end + asc_latest_build_number = latest_testflight_build_number( app_identifier: "com.eatvioapp.app", version: flutter_build_name, diff --git a/pubspec.yaml b/pubspec.yaml index 24223add..3cfa9ee2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: eatvio_app description: A new Flutter project. -version: 1.3.69+158 +version: 1.3.70+159 publish_to: 'none' environment: