Skip to content

Commit 1784918

Browse files
committed
Use Fastlane-idiomatic lane option set readonly when updating certs
I originally went with an env var because it was quicker to implement and I was in the middle of something. Now I have the time to refine the implementation. > Make it work, make it right, make it fast > > – Kent Beck
1 parent 4e1ad5e commit 1784918

File tree

1 file changed

+19
-26
lines changed

1 file changed

+19
-26
lines changed

fastlane/Fastfile

Lines changed: 19 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -924,34 +924,23 @@ platform :ios do
924924
########################################################################
925925
# Configure Lanes
926926
########################################################################
927-
#####################################################################################
928-
# update_certs_and_profiles
929-
# -----------------------------------------------------------------------------------
930-
# This lane downloads all the required certs and profiles and,
931-
# if not run on CI it creates the missing ones.
932-
# -----------------------------------------------------------------------------------
933-
# Usage:
934-
# bundle exec fastlane update_certs_and_profiles
927+
928+
# Downloads all the required certificates and profiles for both production and internal distribution builds.
929+
# Optionally, it can create any new necessary certificate or profile.
935930
#
936-
# Example:
937-
# bundle exec fastlane update_certs_and_profiles
938-
#####################################################################################
939-
lane :update_certs_and_profiles do
940-
alpha_code_signing
941-
appstore_code_signing
931+
# @option [Boolean] readonly (default: true) Whether to only fetch existing certificates and profiles, without generating new ones.
932+
lane :update_certs_and_profiles do |options|
933+
alpha_code_signing(options)
934+
appstore_code_signing(options)
942935
end
943936

944-
########################################################################
945-
# Fastlane match code signing
946-
########################################################################
947-
private_lane :alpha_code_signing do
937+
# Downloads all the required certificates and profiles the enterprise build.
938+
# Optionally, it can create any new necessary certificate or profile.
939+
#
940+
# @option [Boolean] readonly (default: true) Whether to only fetch existing certificates and profiles, without generating new ones.
941+
private_lane :alpha_code_signing do |options|
948942
api_key_path = ASC_KEY_PATH
949-
950-
# We could implement a more refined ENV to boolean conversion to support
951-
# 1, yes, etc. but for the moment and given the limited scope of this tool
952-
# and feature, we can implicitly expect CODE_SIGNING_READONLY to be a
953-
# 'true' or 'false' string.
954-
readonly = ENV.fetch('CODE_SIGNING_READONLY', 'true').to_s.downcase == 'true'
943+
readonly = options.fetch(:readonly, true)
955944

956945
unless readonly
957946
# The Enterprise account APIs do not support authentication via API key.
@@ -972,12 +961,16 @@ platform :ios do
972961
)
973962
end
974963

975-
private_lane :appstore_code_signing do
964+
# Downloads all the required certificates and profiles the production build.
965+
# Optionally, it can create any new necessary certificate or profile.
966+
#
967+
# @option [Boolean] readonly (default: true) Whether to only fetch existing certificates and profiles, without generating new ones.
968+
private_lane :appstore_code_signing do |options|
976969
match(
977970
type: 'appstore',
978971
team_id: get_required_env('EXT_EXPORT_TEAM_ID'),
979972
app_identifier: MAIN_BUNDLE_IDENTIFIERS,
980-
readonly: false,
973+
readonly: options.fetch(:readonly, true),
981974
api_key_path: ASC_KEY_PATH
982975
)
983976
end

0 commit comments

Comments
 (0)