You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improve provisioning profiles update workflow from Fastlane
The previous setup worked great in `readonly = true` mode, but would
consistently fail with `readonly = false` because Apple's Enterprise
portal does not support authentication via API key.
Before this change, we'd hack our way through it by commenting and
editing code to run the public App Store automation as usual, and the
Enterprise one with manual authentication.
With this change, we can call
`CODE_SIGNING_READONLY=1 bundle exec fastlane update_certs_and_profiles`
and be prompted for credentials when necessary. No more editing
`Fastfile` and discarding changes required.
Copy file name to clipboardExpand all lines: fastlane/Fastfile
+32-9Lines changed: 32 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -618,13 +618,7 @@ platform :ios do
618
618
# We're about to use `add_development_certificates_to_provisioning_profiles` and `add_all_devices_to_provisioning_profiles`.
619
619
# These actions use Developer Portal APIs that don't yet support authentication via API key (-.-').
620
620
# Let's preemptively ask for and set the email here to avoid being asked twice for it if not set.
621
-
622
-
require'credentials_manager'
623
-
624
-
# If Fastlane cannot instantiate a user, it will ask the caller for the email.
625
-
# Once we have it, we can set it as `FASTLANE_USER` in the environment (which has lifecycle limited to this call) so that the next commands will already have access to it.
626
-
# Note that if the user is already available to `AccountManager`, setting it in the environment is redundant, but Fastlane doesn't provide a way to check it so we have to do it anyway.
# The Enterprise account APIs do not support authentication via API key.
958
+
# If we want to modify data (readonly = false) we need to authenticate
959
+
# manually.
960
+
prompt_user_for_app_store_connect_credentials
961
+
# We also need to pass no API key path, otherwise Fastlane will give
962
+
# precedence to that authentication mode.
963
+
api_key_path=nil
964
+
end
965
+
954
966
match(
955
967
type: 'enterprise',
956
968
team_id: get_required_env('INT_EXPORT_TEAM_ID'),
957
969
app_identifier: ALPHA_BUNDLE_IDENTIFIERS,
958
-
readonly: true
970
+
readonly: readonly,
971
+
api_key_path: api_key_path
959
972
)
960
973
end
961
974
@@ -964,7 +977,8 @@ platform :ios do
964
977
type: 'appstore',
965
978
team_id: get_required_env('EXT_EXPORT_TEAM_ID'),
966
979
app_identifier: MAIN_BUNDLE_IDENTIFIERS,
967
-
readonly: true
980
+
readonly: false,
981
+
api_key_path: ASC_KEY_PATH
968
982
)
969
983
end
970
984
@@ -1172,6 +1186,15 @@ def buildkite_ci?
1172
1186
ENV.fetch('BUILDKITE',false)
1173
1187
end
1174
1188
1189
+
defprompt_user_for_app_store_connect_credentials
1190
+
require'credentials_manager'
1191
+
1192
+
# If Fastlane cannot instantiate a user, it will ask the caller for the email.
1193
+
# Once we have it, we can set it as `FASTLANE_USER` in the environment (which has lifecycle limited to this call) so that the next commands will already have access to it.
1194
+
# Note that if the user is already available to `AccountManager`, setting it in the environment is redundant, but Fastlane doesn't provide a way to check it so we have to do it anyway.
0 commit comments