@@ -42,6 +42,8 @@ platform :ios do
4242 release : { desctiption : "Release channel: beta or stable" , default : "beta" }
4343 } )
4444
45+ setup_ci if ENV [ 'CI' ]
46+
4547 release_channel = ( options [ :release ] || "beta" ) . capitalize
4648
4749 update_xcconfig_value (
@@ -60,7 +62,9 @@ platform :ios do
6062 upload_bundle_to_tuist
6163 upload_app_to_testflight
6264 notify_all
63- run_tuist ( testflight : false )
65+ unless ENV [ 'CI' ]
66+ run_tuist ( testflight : false )
67+ end
6468 bump_and_tag
6569 end
6670
@@ -71,6 +75,8 @@ platform :ios do
7175 release : { desctiption : "Release channel: beta or stable" , default : "beta" }
7276 } )
7377
78+ setup_ci if ENV [ 'CI' ]
79+
7480 release_channel = ( options [ :release ] || "beta" ) . capitalize
7581
7682 update_xcconfig_value (
@@ -86,7 +92,9 @@ platform :ios do
8692 upload_dsym_to_sentry
8793 upload_bundle_to_tuist
8894 upload_app_to_testflight
89- run_tuist ( testflight : false )
95+ unless ENV [ 'CI' ]
96+ run_tuist ( testflight : false )
97+ end
9098 end
9199
92100 desc "One-off ipa build"
@@ -181,10 +189,7 @@ platform :ios do
181189 scheme : "ForPDA" ,
182190 output_directory : "Builds/" ,
183191 output_name : output_name ,
184- cloned_source_packages_path : "SourcePackages" ,
185192 configuration : "Release" ,
186- silent : true ,
187- suppress_xcode_output : true ,
188193 skip_package_pkg : true ,
189194 export_method : "app-store" ,
190195 export_options : {
@@ -199,11 +204,8 @@ platform :ios do
199204
200205 desc "Uploads DSYM files to Sentry"
201206 lane :upload_dsym_to_sentry do
202- auth_token = get_xcconfig_value (
203- path : 'Configs/Secrets.xcconfig' ,
204- name : 'SENTRY_DSYM_TOKEN'
205- )
206-
207+ auth_token = get_secret_value ( 'SENTRY_DSYM_TOKEN' )
208+
207209 sentry_debug_files_upload (
208210 auth_token : auth_token ,
209211 org_slug : 'forpda' ,
@@ -224,11 +226,24 @@ platform :ios do
224226
225227 desc "Uploads app to TestFlight"
226228 lane :upload_app_to_testflight do
227- app_store_connect_api_key (
228- key_id : "X36R58TMRJ" ,
229- issuer_id : "814e488e-06ba-40ba-a16c-a63e7164023f" ,
230- key_filepath : "Fastlane/AuthKey_X36R58TMRJ.p8"
231- )
229+ key_id = "X36R58TMRJ"
230+ issuer_id = "814e488e-06ba-40ba-a16c-a63e7164023f"
231+
232+ if ENV [ 'CI' ]
233+ key_content = ENV [ 'CONNECT_API_KEY' ]
234+ app_store_connect_api_key (
235+ key_id : key_id ,
236+ issuer_id : issuer_id ,
237+ key_content : key_content
238+ )
239+ else
240+ key_filepath = "Fastlane/AuthKey_X36R58TMRJ.p8"
241+ app_store_connect_api_key (
242+ key_id : key_id ,
243+ issuer_id : issuer_id ,
244+ key_filepath : key_filepath
245+ )
246+ end
232247
233248 version = get_xcconfig_value ( path : 'Configs/App.xcconfig' , name : 'MARKETING_VERSION' )
234249 build = get_xcconfig_value ( path : 'Configs/App.xcconfig' , name : 'CURRENT_PROJECT_VERSION' )
@@ -287,4 +302,23 @@ def print_lane_options(lane_name, options = {})
287302 default_str = value [ :default ] ? " (default: #{ value [ :default ] } )" : ""
288303 UI . message ( "• #{ key } : #{ value [ :description ] } #{ default_str } " )
289304 end
290- end
305+ end
306+
307+ def get_secret_value ( name )
308+ is_ci = ENV [ 'CI' ] == 'true'
309+
310+ if is_ci
311+ value = ENV [ name ]
312+ UI . message ( "Using #{ name } from environment (CI=true)" )
313+ else
314+ xcconfig_path = 'Configs/Secrets.local.xcconfig'
315+ value = get_xcconfig_value ( path : xcconfig_path , name : name )
316+ UI . message ( "Using #{ name } from #{ xcconfig_path } (CI=false)" )
317+ end
318+
319+ if value . nil? || value . empty?
320+ UI . user_error ( "Error: #{ name } is not set" )
321+ end
322+
323+ value
324+ end
0 commit comments