From dbf84989831109719ee524b8889da8909961e959 Mon Sep 17 00:00:00 2001 From: Jamie <2119834+jamieQ@users.noreply.github.com> Date: Thu, 17 Sep 2026 06:18:48 -0500 Subject: [PATCH] feat(ios): Upload thinned IPA through Fastlane --- .github/workflows/ios_sentry_upload_pr.yml | 2 +- ios/Gemfile.lock | 4 +- ios/fastlane/Fastfile | 67 ++-------------------- ios/fastlane/Pluginfile | 2 +- 4 files changed, 10 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ios_sentry_upload_pr.yml b/.github/workflows/ios_sentry_upload_pr.yml index 255a119d..2bdff75f 100644 --- a/.github/workflows/ios_sentry_upload_pr.yml +++ b/.github/workflows/ios_sentry_upload_pr.yml @@ -35,7 +35,7 @@ jobs: run: | echo $CERTIFICATE_BASE64 | base64 --decode > signing-cert.p12 - - name: Build Release app and upload thinned XCArchive to Sentry + - name: Build Release app and upload thinned IPA to Sentry run: bundle exec fastlane ios build_upload_thinned_sentry_size_analysis env: ASC_KEY_ID: ${{ secrets.ASC_KEY_ID }} diff --git a/ios/Gemfile.lock b/ios/Gemfile.lock index 87d4f76e..15ee2a37 100644 --- a/ios/Gemfile.lock +++ b/ios/Gemfile.lock @@ -123,7 +123,7 @@ GEM xcodeproj (>= 1.13.0, < 2.0.0) xcpretty (~> 0.4.1) xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) - fastlane-plugin-sentry (2.5.2) + fastlane-plugin-sentry (2.7.0) os (~> 1.1, >= 1.1.4) fastlane-sirp (1.1.0) gh_inspector (1.1.3) @@ -242,7 +242,7 @@ PLATFORMS DEPENDENCIES fastlane - fastlane-plugin-sentry (>= 2.5.1, < 3.0.0) + fastlane-plugin-sentry (>= 2.7.0, < 3.0.0) xcpretty BUNDLED WITH diff --git a/ios/fastlane/Fastfile b/ios/fastlane/Fastfile index c1944c97..cd001859 100644 --- a/ios/fastlane/Fastfile +++ b/ios/fastlane/Fastfile @@ -180,22 +180,22 @@ platform :ios do ) end - desc 'Build, thin, and upload an XCArchive to Sentry for Size Analysis' + desc 'Build, thin, and upload an IPA to Sentry for Size Analysis' lane :build_upload_thinned_sentry_size_analysis do load_asc_api_key prepare_signing build_app_for_scheme ipa_path = export_thinned_size_analysis_ipa - xcarchive_path = lane_context[SharedValues::XCODEBUILD_ARCHIVE] - replace_xcarchive_app_with_ipa( - ipa_path: ipa_path, - xcarchive_path: xcarchive_path + xcarchive_path = File.expand_path( + lane_context[SharedValues::XCODEBUILD_ARCHIVE], + File.expand_path('..', __dir__) ) sentry_upload_build( auth_token: ENV['SENTRY_SENTRY_AUTH_TOKEN'], org_slug: 'sentry', project_slug: 'hackernews-ios', - xcarchive_path: xcarchive_path, + ipa_path: ipa_path, + dsym_path: File.join(xcarchive_path, 'dSYMs'), build_configuration: 'Release', log_level: 'debug' ) @@ -269,61 +269,6 @@ platform :ios do ipa_path end - desc 'Replace the app in an XCArchive with the app from an IPA' - private_lane :replace_xcarchive_app_with_ipa do |options| - xcarchive_path = options[:xcarchive_path] - ipa_path = options[:ipa_path] - UI.user_error!('No XCArchive provided') unless xcarchive_path - UI.user_error!('No IPA provided') unless ipa_path - - project_root = File.expand_path('..', __dir__) - xcarchive_path = File.expand_path(xcarchive_path, project_root) - ipa_path = File.expand_path(ipa_path, project_root) - extracted_ipa_path = File.join(project_root, 'build', 'sentry-size-analysis', 'extracted-ipa') - - UI.user_error!("XCArchive not found at #{xcarchive_path}") unless File.directory?(xcarchive_path) - UI.user_error!("IPA not found at #{ipa_path}") unless File.file?(ipa_path) - - FileUtils.rm_rf(extracted_ipa_path) - FileUtils.mkdir_p(extracted_ipa_path) - sh( - [ - '/usr/bin/ditto', - '-x', '-k', - Shellwords.escape(ipa_path), - Shellwords.escape(extracted_ipa_path) - ].join(' ') - ) - - ipa_app_paths = Dir.glob(File.join(extracted_ipa_path, 'Payload', '*.app')) - unless ipa_app_paths.one? - UI.user_error!("Expected one app in the IPA, found #{ipa_app_paths.length}") - end - ipa_app_path = ipa_app_paths.first - - xcarchive_app_path = File.join( - xcarchive_path, - 'Products', - 'Applications', - File.basename(ipa_app_path) - ) - unless File.directory?(xcarchive_app_path) - UI.user_error!("No app matching #{File.basename(ipa_app_path)} found in the XCArchive") - end - - # Keep the XCArchive's dSYMs and metadata while replacing its app payload. - FileUtils.rm_rf(xcarchive_app_path) - sh( - [ - '/usr/bin/ditto', - Shellwords.escape(ipa_app_path), - Shellwords.escape(xcarchive_app_path) - ].join(' ') - ) - - UI.success("Replaced the XCArchive app with the IPA app: #{xcarchive_app_path}") - end - desc 'Build an Ad Hoc archive and upload it to Sentry Build Distribution' lane :build_upload_sentry_distribution do load_asc_api_key diff --git a/ios/fastlane/Pluginfile b/ios/fastlane/Pluginfile index 521e6116..3ea8cc4e 100644 --- a/ios/fastlane/Pluginfile +++ b/ios/fastlane/Pluginfile @@ -2,4 +2,4 @@ # # Ensure this file is checked in to source control! -gem 'fastlane-plugin-sentry', '>= 2.5.1', '< 3.0.0' +gem 'fastlane-plugin-sentry', '>= 2.7.0', '< 3.0.0'