Skip to content

Commit d4e0753

Browse files
Merge pull request #5 from refetch-io/feat/ios-signing-team
Pass the signing team and profile to xcodebuild
2 parents 1b00df3 + 88b3ec1 commit d4e0753

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

ios/fastlane/Fastfile

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
# IOS_SCHEME — Xcode scheme name (default: "Runner")
2222
# ---------------------------------------------------------------
2323

24+
require "shellwords"
25+
2426
default_platform(:ios)
2527

2628
# ------------------------------------------------------------------
@@ -62,6 +64,22 @@ def appstore_export_options(app_id)
6264
}
6365
end
6466

67+
# The Flutter template ships no DEVELOPMENT_TEAM, and manual signing will not
68+
# infer one — xcodebuild fails the archive with "Signing for 'Runner' requires
69+
# a development team". Passing the team and profile here keeps them out of the
70+
# checked-in project, so the Fastfile stays project-agnostic.
71+
def appstore_xcargs(app_id)
72+
team = ENV["TEAM_ID"]
73+
UI.user_error!("TEAM_ID env var must be set (Apple Developer Team ID)") if team.nil? || team.empty?
74+
75+
[
76+
"DEVELOPMENT_TEAM=#{team.shellescape}",
77+
"CODE_SIGN_STYLE=Manual",
78+
"PROVISIONING_PROFILE_SPECIFIER=#{appstore_profile_name(app_id).shellescape}",
79+
"CODE_SIGN_IDENTITY=#{'Apple Distribution'.shellescape}",
80+
].join(" ")
81+
end
82+
6583
platform :ios do
6684
# ------------------------------------------------------------------
6785
# Helper: Build the App Store Connect API key from environment vars
@@ -125,6 +143,7 @@ platform :ios do
125143
scheme: ios_scheme,
126144
export_method: "app-store",
127145
export_options: appstore_export_options(app_id),
146+
xcargs: appstore_xcargs(app_id),
128147
output_directory: "../build/ios",
129148
output_name: ipa_output_name,
130149
)
@@ -148,6 +167,7 @@ platform :ios do
148167
scheme: ios_scheme,
149168
export_method: "app-store",
150169
export_options: appstore_export_options(app_id),
170+
xcargs: appstore_xcargs(app_id),
151171
output_directory: "../build/ios",
152172
output_name: ipa_output_name,
153173
)
@@ -221,6 +241,7 @@ platform :ios do
221241
scheme: ios_scheme,
222242
export_method: "app-store",
223243
export_options: appstore_export_options(app_id),
244+
xcargs: appstore_xcargs(app_id),
224245
output_directory: "../build/ios",
225246
output_name: ipa_output_name,
226247
)

0 commit comments

Comments
 (0)