Skip to content

Commit 0b50b1f

Browse files
authored
feat: Add support for APK, AAB, and IPA uploads to sentry_upload_build (#397)
1 parent 43ffe3b commit 0b50b1f

File tree

4 files changed

+416
-10
lines changed

4 files changed

+416
-10
lines changed

.rubocop.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,7 @@ RSpec/SpecFilePathFormat:
279279
# Different test cases can have similar structure in integration tests
280280
RSpec/RepeatedExample:
281281
Enabled: false
282+
283+
# Allow deeper nesting for platform-specific test groups (APK, AAB, IPA)
284+
RSpec/NestedGroups:
285+
Max: 4

CHANGELOG.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Changelog
22

3+
## Unreleased
4+
5+
### Breaking Changes
6+
7+
Due to sentry-cli 3.0.0 upgrade, the following breaking changes have been made ([#370](https://github.com/getsentry/sentry-fastlane-plugin/pull/370)):
8+
9+
- **`sentry_upload_file` action has been removed**: The `releases files` commands were removed in sentry-cli 3.0.0. Users should migrate to `sentry_upload_sourcemap` for source maps or other specialized upload actions.
10+
- **`android_manifest_path` parameter in `sentry_upload_proguard` has been removed**: The `--android-manifest` argument was removed in sentry-cli 3.0.0 and is no longer needed. Any Fastfiles still using this parameter will need to remove it.
11+
- **`path` parameter default behavior changed in `sentry_debug_files_upload`**: The `path` parameter now defaults to `DSYM_OUTPUT_PATH` from fastlane's lane context if available (set by actions like `build_app` or `ipa`), otherwise falls back to `'.'` (current directory). This changes the default behavior when `DSYM_OUTPUT_PATH` is set, which may affect users who were relying on the previous behavior of always searching from the current directory. Users can explicitly specify `path: '.'` to maintain the previous behavior. This addresses issue [#377](https://github.com/getsentry/sentry-fastlane-plugin/issues/377).
12+
- **`api_key` parameter has been removed**: The `api_key` parameter has been removed in favor of `auth_token`. All actions now require `auth_token` for authentication. Users should update their Fastfiles to use `auth_token` instead of `api_key`. ([#376](https://github.com/getsentry/sentry-fastlane-plugin/pull/376))
13+
- **`force_foreground` parameter has been removed**: This parameter was deprecated as a no-op since v1.26.0 and has now been removed from `sentry_debug_files_upload`. Users should remove this parameter from their Fastfiles. ([#376](https://github.com/getsentry/sentry-fastlane-plugin/pull/376))
14+
- **`sentry_upload_dsym` action has been removed**: This action has been deprecated in favor of `sentry_debug_files_upload`. Users should migrate to `sentry_debug_files_upload` with the appropriate `path` parameter. ([#375](https://github.com/getsentry/sentry-fastlane-plugin/pull/375))
15+
- **`sentry_upload_dif` action has been removed**: This action has been deprecated in favor of `sentry_debug_files_upload`. Users should migrate to `sentry_debug_files_upload` with the appropriate `path` parameter. ([#375](https://github.com/getsentry/sentry-fastlane-plugin/pull/375))
16+
- **`ids` parameter renamed to `id` in `sentry_debug_files_upload`**: The parameter has been renamed from `ids` to `id` to match sentry-cli v3. Users should update their Fastfiles to use `id` instead of `ids`.
17+
- **Removed deprecated parameters from `sentry_debug_files_upload`**: The following parameters have been removed as they are no longer supported in sentry-cli v3: `info_plist`, `no_reprocessing`, `upload_symbol_maps`. Users should remove these parameters from their Fastfiles.
18+
19+
See the [sentry-cli 3.0.0 release notes](https://github.com/getsentry/sentry-cli/releases/tag/3.0.0) for more details on CLI changes.
20+
21+
### Features
22+
23+
- Set `SENTRY_PIPELINE` environment variable for all sentry-cli invocations to identify the plugin and version ([#365](https://github.com/getsentry/sentry-fastlane-plugin/pull/365))
24+
- **Added missing sentry-cli v3 options to all actions**: All actions have been updated to support all available options from sentry-cli version 3.0.1:
25+
- **`sentry_debug_files_upload`**: Added `wait_for`, `no_upload`, `il2cpp_mapping` options. Fixed `id` parameter (was `ids`). Updated type validation to include `jvm`, `portablepdb`, and `wasm` types. Removed deprecated options (`info_plist`, `no_reprocessing`, `upload_symbol_maps`) that are no longer supported in sentry-cli v3. (#382)
26+
- **`sentry_upload_sourcemap`**: Added `url_suffix`, `note`, `validate`, `decompress`, `wait`, `wait_for`, `no_sourcemap_reference`, `debug_id_reference`, `bundle`, `bundle_sourcemap`, `ext` (array support), and `strict` options.
27+
- **`sentry_upload_proguard`**: Added `no_upload`, `write_properties`, `require_one`, and `uuid` options.
28+
- **`sentry_upload_build`**: Added `release_notes`, `force_git_metadata`, and `no_git_metadata` options.
29+
- **`sentry_create_release`**: Added `url` option.
30+
- **`sentry_finalize_release`**: Added `url` and `released` options.
31+
- **`sentry_set_commits`**: Added `local` and `initial_depth` options.
32+
- Add support for uploading Android App Bundles (.aab), Android APK files (.apk) and iOS app bundles (.ipa) to `sentry_upload_build` action ([#397](https://github.com/getsentry/sentry-fastlane-plugin/pull/397))
33+
34+
### Improvements
35+
36+
- **`sentry_upload_sourcemap` internal command changed**: Now uses `sourcemaps upload --release <version>` instead of `releases files <version> upload-sourcemaps`. This is an internal change and should not affect users unless they are mocking or testing the CLI commands ([#370](https://github.com/getsentry/sentry-fastlane-plugin/pull/370)).
37+
38+
### Dependencies
39+
40+
- Bump CLI from v2.58.2 to v3.1.0 ([#366](https://github.com/getsentry/sentry-fastlane-plugin/pull/366), [#367](https://github.com/getsentry/sentry-fastlane-plugin/pull/367), [#369](https://github.com/getsentry/sentry-fastlane-plugin/pull/369), [#371](https://github.com/getsentry/sentry-fastlane-plugin/pull/371), [#378](https://github.com/getsentry/sentry-fastlane-plugin/pull/378), [#383](https://github.com/getsentry/sentry-fastlane-plugin/pull/383))
41+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#310)
42+
- [diff](https://github.com/getsentry/sentry-cli/compare/2.58.2...3.1.0)
43+
344
## 2.0.0-rc.2
445

546
### Breaking Changes

lib/fastlane/plugin/sentry/actions/sentry_upload_build.rb

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,43 @@ class SentryUploadBuildAction < Action
44
def self.run(params)
55
Helper::SentryConfig.parse_api_params(params)
66

7-
# Verify xcarchive path
8-
xcarchive_path = params[:xcarchive_path]
9-
UI.user_error!("Could not find xcarchive at path '#{xcarchive_path}'") unless File.exist?(xcarchive_path)
10-
UI.user_error!("Path '#{xcarchive_path}' is not an xcarchive") unless File.extname(xcarchive_path) == '.xcarchive'
7+
# Determine which build file path to use (conflicting_options handles mutual exclusivity)
8+
build_path = nil
9+
build_type = nil
10+
11+
if params[:xcarchive_path]
12+
build_path = params[:xcarchive_path]
13+
build_type = :xcarchive
14+
elsif params[:apk_path]
15+
build_path = params[:apk_path]
16+
build_type = :apk
17+
elsif params[:aab_path]
18+
build_path = params[:aab_path]
19+
build_type = :aab
20+
elsif params[:ipa_path]
21+
build_path = params[:ipa_path]
22+
build_type = :ipa
23+
else
24+
UI.user_error!("One of xcarchive_path, apk_path, aab_path, or ipa_path must be provided")
25+
end
26+
27+
UI.user_error!("Could not find build file at path '#{build_path}'") unless File.exist?(build_path)
28+
29+
case build_type
30+
when :xcarchive
31+
UI.user_error!("Path '#{build_path}' is not an xcarchive") unless File.extname(build_path) == '.xcarchive'
32+
when :apk
33+
UI.user_error!("Path '#{build_path}' is not an APK") unless File.extname(build_path).casecmp('.apk').zero?
34+
when :aab
35+
UI.user_error!("Path '#{build_path}' is not an AAB") unless File.extname(build_path).casecmp('.aab').zero?
36+
when :ipa
37+
UI.user_error!("Path '#{build_path}' is not an IPA") unless File.extname(build_path).casecmp('.ipa').zero?
38+
end
1139

1240
command = [
1341
"build",
1442
"upload",
15-
File.absolute_path(xcarchive_path)
43+
File.absolute_path(build_path)
1644
]
1745

1846
# Add git-related parameters if provided
@@ -30,30 +58,67 @@ def self.run(params)
3058
command << "--no-git-metadata" if params[:no_git_metadata]
3159

3260
Helper::SentryHelper.call_sentry_cli(params, command)
33-
UI.success("Successfully uploaded build archive: #{xcarchive_path}")
61+
UI.success("Successfully uploaded build file: #{build_path}")
3462
end
3563

3664
#####################################################
3765
# @!group Documentation
3866
#####################################################
3967

4068
def self.description
41-
"Upload iOS build archive to Sentry with optional git context"
69+
"Upload build files (iOS .xcarchive/.ipa or Android .apk/.aab) to Sentry with optional git context"
4270
end
4371

4472
def self.details
45-
"This action allows you to upload iOS build archives (.xcarchive) to Sentry with optional git-related parameters for enhanced context including commit SHAs, branch names, repository information, and pull request details."
73+
"This action allows you to upload build files to Sentry. Supported formats include iOS build archives (.xcarchive), iOS app bundles (.ipa), Android APK files (.apk), and Android App Bundles (.aab). The action supports optional git-related parameters for enhanced context including commit SHAs, branch names, repository information, and pull request details."
4674
end
4775

4876
def self.available_options
4977
Helper::SentryConfig.common_api_config_items + [
5078
FastlaneCore::ConfigItem.new(key: :xcarchive_path,
51-
description: "Path to your iOS build archive (.xcarchive)",
79+
description: "Path to your iOS build archive (.xcarchive). Mutually exclusive with apk_path, aab_path, and ipa_path",
5280
default_value: Actions.lane_context[SharedValues::XCODEBUILD_ARCHIVE],
81+
optional: true,
82+
conflicting_options: [:apk_path, :aab_path, :ipa_path],
5383
verify_block: proc do |value|
84+
next if value.nil? || value.to_s.empty?
85+
5486
UI.user_error!("Could not find xcarchive at path '#{value}'") unless File.exist?(value)
5587
UI.user_error!("Path '#{value}' is not an xcarchive") unless File.extname(value) == '.xcarchive'
5688
end),
89+
FastlaneCore::ConfigItem.new(key: :apk_path,
90+
description: "Path to your Android APK file (.apk). Mutually exclusive with xcarchive_path, aab_path, and ipa_path",
91+
default_value: Actions.lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
92+
optional: true,
93+
conflicting_options: [:xcarchive_path, :aab_path, :ipa_path],
94+
verify_block: proc do |value|
95+
next if value.nil? || value.to_s.empty?
96+
97+
UI.user_error!("Could not find APK at path '#{value}'") unless File.exist?(value)
98+
UI.user_error!("Path '#{value}' is not an APK") unless File.extname(value).casecmp('.apk').zero?
99+
end),
100+
FastlaneCore::ConfigItem.new(key: :aab_path,
101+
description: "Path to your Android App Bundle (.aab). Mutually exclusive with xcarchive_path, apk_path, and ipa_path",
102+
default_value: Actions.lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
103+
optional: true,
104+
conflicting_options: [:xcarchive_path, :apk_path, :ipa_path],
105+
verify_block: proc do |value|
106+
next if value.nil? || value.to_s.empty?
107+
108+
UI.user_error!("Could not find AAB at path '#{value}'") unless File.exist?(value)
109+
UI.user_error!("Path '#{value}' is not an AAB") unless File.extname(value).casecmp('.aab').zero?
110+
end),
111+
FastlaneCore::ConfigItem.new(key: :ipa_path,
112+
description: "Path to your iOS app bundle (.ipa). Mutually exclusive with xcarchive_path, apk_path, and aab_path",
113+
default_value: Actions.lane_context[SharedValues::IPA_OUTPUT_PATH],
114+
optional: true,
115+
conflicting_options: [:xcarchive_path, :apk_path, :aab_path],
116+
verify_block: proc do |value|
117+
next if value.nil? || value.to_s.empty?
118+
119+
UI.user_error!("Could not find IPA at path '#{value}'") unless File.exist?(value)
120+
UI.user_error!("Path '#{value}' is not an IPA") unless File.extname(value).casecmp('.ipa').zero?
121+
end),
57122
FastlaneCore::ConfigItem.new(key: :head_sha,
58123
env_name: "SENTRY_HEAD_SHA",
59124
description: "The SHA of the head of the current branch",
@@ -125,7 +190,7 @@ def self.authors
125190
end
126191

127192
def self.is_supported?(platform)
128-
[:ios].include?(platform)
193+
[:ios, :android].include?(platform)
129194
end
130195
end
131196
end

0 commit comments

Comments
 (0)