Skip to content

Commit

Permalink
Add error handling and ensure keychain is deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
ajaxjiang96 committed Apr 3, 2023
1 parent 3b80eed commit f929934
Showing 1 changed file with 27 additions and 22 deletions.
49 changes: 27 additions & 22 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -140,28 +140,33 @@ platform :ios do
use_build_sdk = !ENV['BUILD_SDK'].empty?
use_build_destination = !ENV['BUILD_DESTINATION'].empty?
use_cloned_source_packages_path = !ENV['CLONED_SOURCE_PACKAGES_PATH'].empty?
build_app(
workspace: use_workspace ? ENV['WORKSPACE_PATH'] : nil,
project: !use_workspace ? ENV['PROJECT_PATH'] : nil,
configuration: ENV['CONFIGURATION'],
scheme: ENV['SCHEME'],
output_directory: File.dirname(ENV['OUTPUT_PATH']),
output_name: File.basename(ENV['OUTPUT_PATH']),
clean: true,
cloned_source_packages_path:
if use_cloned_source_packages_path
ENV['CLONED_SOURCE_PACKAGES_PATH']
else
nil
end,
export_method: ENV['EXPORT_METHOD'],
export_options: use_export_options ? ENV['EXPORT_OPTIONS'] : nil,
skip_profile_detection: use_export_options,
sdk: use_build_sdk ? ENV['BUILD_SDK'] : nil,
destination: use_build_destination ? ENV['BUILD_DESTINATION'] : nil
)

delete_keychain(name: 'ios-build.keychain')
begin
build_app(
workspace: use_workspace ? ENV['WORKSPACE_PATH'] : nil,
project: !use_workspace ? ENV['PROJECT_PATH'] : nil,
configuration: ENV['CONFIGURATION'],
scheme: ENV['SCHEME'],
output_directory: File.dirname(ENV['OUTPUT_PATH']),
output_name: File.basename(ENV['OUTPUT_PATH']),
clean: true,
cloned_source_packages_path:
if use_cloned_source_packages_path
ENV['CLONED_SOURCE_PACKAGES_PATH']
else
nil
end,
export_method: ENV['EXPORT_METHOD'],
export_options: use_export_options ? ENV['EXPORT_OPTIONS'] : nil,
skip_profile_detection: use_export_options,
sdk: use_build_sdk ? ENV['BUILD_SDK'] : nil,
destination: use_build_destination ? ENV['BUILD_DESTINATION'] : nil
)
item1 # This causes an error
rescue => ex
UI.error(ex)
ensure
delete_keychain(name: 'ios-build.keychain')
end
end

# https://github.com/CocoaPods/Xcodeproj/issues/505#issuecomment-584699008
Expand Down

0 comments on commit f929934

Please sign in to comment.