diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index 404f293..8659df6 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -55,6 +55,26 @@ def app_project_settings YAML.safe_load(File.read(APP_SPEC)).fetch("targets").fetch(TARGET).fetch("settings").fetch("base") end +def apply_release_signing_settings + require "xcodeproj" + + project = Xcodeproj::Project.open(PROJECT_FILE) + target = project.targets.find { |candidate| candidate.name == TARGET } + UI.user_error!("Could not find target #{TARGET} in #{PROJECT_FILE}") unless target + + target.build_configurations.each do |configuration| + next unless configuration.name == "Release" + + settings = configuration.build_settings + settings["CODE_SIGN_STYLE"] = "Manual" + settings["DEVELOPMENT_TEAM"] = TEAM_ID + settings["PROVISIONING_PROFILE_SPECIFIER"] = PROFILE_SPECIFIER + settings["CODE_SIGN_IDENTITY"] = XCODE_CODE_SIGN_IDENTITY + settings["CODE_SIGN_IDENTITY[sdk=iphoneos*]"] = XCODE_CODE_SIGN_IDENTITY + end + project.save +end + def local_marketing_version app_project_settings.fetch("MARKETING_VERSION").to_s end @@ -404,6 +424,7 @@ platform :ios do UI.user_error!("Build number must be a positive integer") unless build_number.match?(/\A[1-9]\d*\z/) sh("xcodegen --spec #{PROJECT_SPEC.shellescape}") + apply_release_signing_settings xcode_args = [ xcode_build_setting("MARKETING_VERSION", version), @@ -411,8 +432,7 @@ platform :ios do xcode_build_setting("CODE_SIGN_STYLE", "Manual"), xcode_build_setting("DEVELOPMENT_TEAM", TEAM_ID), xcode_build_setting("PROVISIONING_PROFILE_SPECIFIER", PROFILE_SPECIFIER), - xcode_build_setting("CODE_SIGN_IDENTITY", XCODE_CODE_SIGN_IDENTITY), - xcode_build_setting("CODE_SIGN_IDENTITY[sdk=iphoneos*]", XCODE_CODE_SIGN_IDENTITY) + xcode_build_setting("CODE_SIGN_IDENTITY", XCODE_CODE_SIGN_IDENTITY) ] if present?(ENV["SYBIL_SIGNING_KEYCHAIN_PATH"]) xcode_args << xcode_build_setting("OTHER_CODE_SIGN_FLAGS", "--keychain #{ENV.fetch("SYBIL_SIGNING_KEYCHAIN_PATH")}")