@@ -6,7 +6,7 @@ platform :ios do
66 app_store_connect_api_key (
77 key_id : ENV [ "APPSTORE_KEY_ID" ] ,
88 issuer_id : ENV [ "APPSTORE_KEY_ISSUER_ID" ] ,
9- key_content : ENV [ "APPSTORE_KEY_CONTENT " ] ,
9+ key_content : ENV [ "APPSTORE_KEY_CONTENT_BASE64 " ] ,
1010 is_key_content_base64 : true ,
1111 )
1212
@@ -21,7 +21,8 @@ platform :ios do
2121 app_store_connect_api_key (
2222 key_id : ENV [ "APPSTORE_KEY_ID" ] ,
2323 issuer_id : ENV [ "APPSTORE_KEY_ISSUER_ID" ] ,
24- key_content : ENV [ "APPSTORE_KEY_CONTENT" ] ,
24+ key_content : ENV [ "APPSTORE_KEY_CONTENT_BASE64" ] ,
25+ is_key_content_base64 : true ,
2526 )
2627
2728 if is_ci
@@ -73,3 +74,86 @@ platform :ios do
7374 )
7475 end
7576end
77+
78+ platform :mac do
79+ desc "Sync certificates and provisioning profiles for macOS"
80+ lane :sync_certificates do
81+ app_store_connect_api_key (
82+ key_id : ENV [ "APPSTORE_KEY_ID" ] ,
83+ issuer_id : ENV [ "APPSTORE_KEY_ISSUER_ID" ] ,
84+ key_content : ENV [ "APPSTORE_KEY_CONTENT_BASE64" ] ,
85+ is_key_content_base64 : true ,
86+ )
87+
88+ match (
89+ type : "appstore" ,
90+ platform : "macos" ,
91+ additional_cert_types : [ "mac_installer_distribution" ] ,
92+ )
93+ end
94+
95+ desc "Deploy to Mac App Store"
96+ lane :deploy do
97+ keychain_name = ENV [ "MATCH_KEYCHAIN_NAME" ]
98+ keychain_password = ENV [ "MATCH_KEYCHAIN_PASSWORD" ]
99+
100+ app_store_connect_api_key (
101+ key_id : ENV [ "APPSTORE_KEY_ID" ] ,
102+ issuer_id : ENV [ "APPSTORE_KEY_ISSUER_ID" ] ,
103+ key_content : ENV [ "APPSTORE_KEY_CONTENT_BASE64" ] ,
104+ is_key_content_base64 : true ,
105+ )
106+
107+ if is_ci
108+ delete_keychain (
109+ name : keychain_name
110+ ) if File . exist? File . expand_path ( "~/Library/Keychains/#{ keychain_name } -db" )
111+ create_keychain (
112+ name : keychain_name ,
113+ password : keychain_password ,
114+ default_keychain : true ,
115+ unlock : true ,
116+ timeout : 3600 ,
117+ lock_when_sleeps : false ,
118+ require_create : true ,
119+ )
120+ end
121+
122+ match (
123+ type : "appstore" ,
124+ platform : "macos" ,
125+ additional_cert_types : [ "mac_installer_distribution" ] ,
126+ readonly : is_ci ,
127+ keychain_name : keychain_name ,
128+ keychain_password : keychain_password ,
129+ )
130+
131+ update_code_signing_settings (
132+ use_automatic_signing : false ,
133+ path : "macos/Runner.xcodeproj" ,
134+ team_id : ENV [ "TEAM_ID" ] ,
135+ bundle_identifier : "dev.flchart.app" ,
136+ profile_name : "match AppStore dev.flchart.app macos" ,
137+ code_sign_identity : "Apple Distribution" ,
138+ )
139+
140+ build_app (
141+ workspace : "macos/Runner.xcworkspace" ,
142+ scheme : "Runner" ,
143+ export_method : "app-store" ,
144+ destination : "generic/platform=macOS" ,
145+ export_options : {
146+ provisioningProfiles : {
147+ "dev.flchart.app" => "match AppStore dev.flchart.app macos"
148+ }
149+ }
150+ )
151+
152+ upload_to_app_store (
153+ skip_metadata : true ,
154+ skip_screenshots : true ,
155+ precheck_include_in_app_purchases : false ,
156+ platform : "osx" ,
157+ )
158+ end
159+ end
0 commit comments