Skip to content

Commit 912dd06

Browse files
committed
fix: fastlane issues
1 parent 19a3077 commit 912dd06

File tree

1 file changed

+21
-7
lines changed

1 file changed

+21
-7
lines changed

examples/SampleApp/fastlane/Fastfile

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ end
3131
#######################
3232

3333
platform :ios do
34+
private_lane :missing_appstore_build_error? do |options|
35+
message = options[:message].to_s
36+
37+
message.include?('Could not find a live-version') ||
38+
message.include?('Could not find a beta-version') ||
39+
message.include?('Could not find a build')
40+
end
41+
3442
private_lane :latest_appstore_version_code do |options|
3543
livestates = [true, false]
3644
version_codes = []
@@ -41,11 +49,19 @@ platform :ios do
4149
app_identifier: bundle_id
4250
)
4351
rescue StandardError => e
44-
UI.user_error!("app_store_build_number failed for liveState: #{livestate} bundle_id: #{bundle_id}. #{e.message}")
52+
if missing_appstore_build_error?(message: e.message)
53+
UI.message(
54+
"No App Store Connect build found for liveState: #{livestate} bundle_id: #{bundle_id}",
55+
)
56+
else
57+
UI.user_error!(
58+
"app_store_build_number failed for liveState: #{livestate} bundle_id: #{bundle_id}. #{e.message}",
59+
)
60+
end
4561
else
4662
version_codes.append(vc)
4763
end
48-
version_codes.max
64+
version_codes.compact.max
4965
end
5066

5167
lane :deploy_to_testflight_qa do |options|
@@ -61,14 +77,12 @@ platform :ios do
6177
xcodeproj: xcode_project
6278
)
6379

64-
current_build_number = latest_appstore_version_code
80+
current_build_number = latest_appstore_version_code || get_build_number(
81+
xcodeproj: xcode_project,
82+
).to_i
6583

6684
puts("Current build number: #{current_build_number}")
6785

68-
if current_build_number.nil?
69-
UI.user_error!("No App Store build number found for bundle_id: #{bundle_id}")
70-
end
71-
7286
increment_build_number(
7387
build_number: current_build_number + 1,
7488
xcodeproj: xcode_project

0 commit comments

Comments
 (0)