@@ -209,24 +209,24 @@ platform :ios do
209209 lane :export_thinned_build do |options |
210210 xcarchive_path = lane_context [ SharedValues ::XCODEBUILD_ARCHIVE ]
211211 UI . message ( "Using archive: #{ xcarchive_path } " )
212-
212+
213213 # Device type configuration for thinning, default is iPhone 16 Pro
214214 device_type = options [ :device_type ] || 'iPhone17,1'
215215 UI . message ( "Thinning for device type: #{ device_type } " )
216-
216+
217217 # Export options for thinning
218218 export_options = {
219219 method : 'ad-hoc' ,
220220 thinning : device_type , # This creates a thinned build for the specific device type
221221 team_id : ENV [ 'APPLE_TEAM_ID' ]
222222 }
223-
223+
224224 # Add provisioning profiles if available
225225 app_identifier = CredentialsManager ::AppfileConfig . try_fetch_value ( :app_identifier )
226226 bundle_identifier = ENV [ 'BUNDLE_ID' ] || app_identifier
227227 profile_name = 'HackerNews AdHoc Distribution'
228228 widget_profile_name = 'HackerNews AdHoc HomeWidget'
229-
229+
230230 export_options [ :provisioningProfiles ] = {
231231 bundle_identifier => profile_name ,
232232 'com.emergetools.hackernews.HackerNewsHomeWidget' => widget_profile_name
@@ -240,10 +240,10 @@ platform :ios do
240240 sh ( "#{ xcsafe } -exportArchive -archivePath #{ xcarchive_path } -exportOptionsPlist export_options.plist -exportPath ./build" )
241241
242242 plist_data = Plist . parse_xml ( './build/app-thinning.plist' )
243-
243+
244244 # Find the variant matching our device and OS version
245245 target_ipa_path = nil
246-
246+
247247 if plist_data && plist_data [ 'variants' ]
248248 plist_data [ 'variants' ] . each do |variant |
249249 path = variant [ 0 ]
@@ -256,43 +256,54 @@ platform :ios do
256256 end
257257 end
258258 end
259-
259+
260260 ipa_path = File . join ( '../' , target_ipa_path )
261261 UI . message ( "Using IPA: #{ ipa_path } " )
262-
262+
263263 temp_dir = './build/temp_extraction'
264264 FileUtils . rm_rf ( temp_dir ) if Dir . exist? ( temp_dir )
265265 FileUtils . mkdir_p ( temp_dir )
266-
266+
267267 # Extract the IPA
268268 sh ( "cd #{ temp_dir } && unzip -q '#{ ipa_path } '" )
269269 payload_dir = File . join ( temp_dir , 'Payload' )
270270 app_files = Dir . glob ( File . join ( payload_dir , '*.app' ) )
271-
271+
272272 if app_files . empty?
273273 UI . error ( "No .app file found in extracted IPA" )
274274 return
275275 end
276-
276+
277277 thinned_app_path = app_files . first
278278 # Find the original .app in the XCArchive
279279 original_app_pattern = File . join ( xcarchive_path , 'Products' , 'Applications' , '*.app' )
280280 original_app_files = Dir . glob ( original_app_pattern )
281-
281+
282282 original_app_path = original_app_files . first
283-
283+
284284 FileUtils . rm_rf ( original_app_path )
285285 FileUtils . cp_r ( thinned_app_path , original_app_path )
286-
286+
287287 # Clean up temporary directory
288288 FileUtils . rm_rf ( temp_dir )
289289 end
290-
290+
291291 UI . success ( "Successfully replaced app in XCArchive with thinned build for #{ device_type } " )
292292 end
293293
294+ desc 'Upload SnapshotPreviews snapshots to Sentry'
295+ lane :upload_sentry_snapshots do |options |
296+ sentry_upload_snapshots (
297+ path : options [ :path ] ,
298+ app_id : 'com.emergetools.hackernews' ,
299+ auth_token : ENV [ 'SENTRY_SENTRY_AUTH_TOKEN' ] ,
300+ org_slug : 'sentry' ,
301+ project_slug : 'hackernews-ios'
302+ )
303+ end
304+
294305 desc 'Upload swift-snapshot-testing snapshots to Sentry'
295- lane :upload_sentry_snapshots do
306+ lane :upload_sentry_snapshots_swift_snapshot_testing do
296307 sentry_upload_snapshots (
297308 path : 'HackerNewsTests/__Snapshots__/SwiftSnapshotTest' ,
298309 app_id : 'com.emergetools.hackernews' ,
0 commit comments