33default_platform ( :ios )
44
55platform :ios do
6- desc "Sync certificates and provisioning profiles"
7- lane :sync_certificates do
8- match (
9- type : "appstore" ,
10- readonly : is_ci ,
11- app_identifier : "v2er.app" ,
12- git_url : ENV [ "MATCH_GIT_URL" ] || "git@github.com:graycreate/certificates-v2er-iOS.git"
13- )
14- end
15-
16- desc "Build and upload to TestFlight"
17- lane :beta do
18- # Ensure we have the latest certificates
19- sync_certificates
20-
21- # Get App Store Connect API key from environment
22- api_key = app_store_connect_api_key (
6+ # Helper method to get App Store Connect API key
7+ private_lane :get_api_key do
8+ app_store_connect_api_key (
239 key_id : ENV [ "APP_STORE_CONNECT_API_KEY_KEY_ID" ] ,
2410 issuer_id : ENV [ "APP_STORE_CONNECT_API_KEY_ISSUER_ID" ] ,
2511 key_filepath : ENV [ "APP_STORE_CONNECT_API_KEY_KEY" ] ,
2612 in_house : false
2713 )
14+ end
2815
29- # Build the app
16+ # Helper method for building the app
17+ private_lane :build_ipa do
3018 build_app (
3119 scheme : "V2er" ,
3220 export_method : "app-store" ,
@@ -39,6 +27,28 @@ platform :ios do
3927 output_directory : "./build" ,
4028 output_name : "V2er.ipa"
4129 )
30+ end
31+
32+ desc "Sync certificates and provisioning profiles"
33+ lane :sync_certificates do
34+ match (
35+ type : "appstore" ,
36+ readonly : is_ci ,
37+ app_identifier : "v2er.app" ,
38+ git_url : ENV [ "MATCH_GIT_URL" ] || "git@github.com:graycreate/certificates-v2er-iOS.git"
39+ )
40+ end
41+
42+ desc "Build and upload to TestFlight"
43+ lane :beta do
44+ # Ensure we have the latest certificates
45+ sync_certificates
46+
47+ # Get App Store Connect API key
48+ api_key = get_api_key
49+
50+ # Build the app
51+ build_ipa
4252
4353 # Upload to TestFlight
4454 upload_to_testflight (
@@ -64,27 +74,11 @@ platform :ios do
6474 # Ensure we have the latest certificates
6575 sync_certificates
6676
67- # Get App Store Connect API key from environment
68- api_key = app_store_connect_api_key (
69- key_id : ENV [ "APP_STORE_CONNECT_API_KEY_KEY_ID" ] ,
70- issuer_id : ENV [ "APP_STORE_CONNECT_API_KEY_ISSUER_ID" ] ,
71- key_filepath : ENV [ "APP_STORE_CONNECT_API_KEY_KEY" ] ,
72- in_house : false
73- )
77+ # Get App Store Connect API key
78+ api_key = get_api_key
7479
7580 # Build the app
76- build_app (
77- scheme : "V2er" ,
78- export_method : "app-store" ,
79- export_options : {
80- provisioningProfiles : {
81- "v2er.app" => "match AppStore v2er.app"
82- }
83- } ,
84- clean : true ,
85- output_directory : "./build" ,
86- output_name : "V2er.ipa"
87- )
81+ build_ipa
8882
8983 # Upload to App Store Connect
9084 upload_to_app_store (
@@ -98,12 +92,7 @@ platform :ios do
9892
9993 desc "Create a new version on App Store Connect"
10094 lane :create_app_version do |options |
101- api_key = app_store_connect_api_key (
102- key_id : ENV [ "APP_STORE_CONNECT_API_KEY_KEY_ID" ] ,
103- issuer_id : ENV [ "APP_STORE_CONNECT_API_KEY_ISSUER_ID" ] ,
104- key_filepath : ENV [ "APP_STORE_CONNECT_API_KEY_KEY" ] ,
105- in_house : false
106- )
95+ api_key = get_api_key
10796
10897 deliver (
10998 api_key : api_key ,
@@ -116,12 +105,7 @@ platform :ios do
116105
117106 desc "Download metadata from App Store Connect"
118107 lane :download_metadata do
119- api_key = app_store_connect_api_key (
120- key_id : ENV [ "APP_STORE_CONNECT_API_KEY_KEY_ID" ] ,
121- issuer_id : ENV [ "APP_STORE_CONNECT_API_KEY_ISSUER_ID" ] ,
122- key_filepath : ENV [ "APP_STORE_CONNECT_API_KEY_KEY" ] ,
123- in_house : false
124- )
108+ api_key = get_api_key
125109
126110 download_dsyms ( api_key : api_key )
127111
0 commit comments