fix(fastlane): upload and attach only the gplayRelease outputs

upload_to_play_store defaulted apk_paths to every APK under
build/outputs, failing with "Cannot provide both apk(s) and aab" when
debug builds were around. The lanes also used GRADLE_*_OUTPUT_PATH,
which is merely the newest file there, so the GitHub release could get
a stale debug APK. Select the gplayRelease outputs by path instead.
This commit is contained in:
Davide Depau committed 2026-11-04 19:15:04 +01:00
1 parent c3478e86c3
commit 14af534a59
1 file changed
+10 -2
+10 -2
View File
@@ -29,13 +29,20 @@ platform :android do
)
end
# fastlane's GRADLE_*_OUTPUT_PATH is just the newest file under build/outputs, which can be a
# stale debug build, so pick the gplayRelease output by its path.
def output(key, suffix)
lane_context[key].find { |path| path.end_with?(suffix) } or UI.user_error!("No #{suffix} built")
end
desc "Upload a signed bundle to Google Play, leaving it in pending changes to send for review manually"
lane :play do |options|
build("bundle")
upload_to_play_store(
package_name: "eu.depau.etchdroid",
track: options[:track] || "production",
aab: lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH],
aab: output(SharedValues::GRADLE_ALL_AAB_OUTPUT_PATHS, "/gplayRelease/app-gplay-release.aab"),
skip_upload_apk: true, # would otherwise default to every APK under build/outputs
changes_not_sent_for_review: true,
skip_upload_metadata: true,
skip_upload_images: true,
@@ -47,7 +54,8 @@ platform :android do
lane :github do
version = File.read("../app/build.gradle.kts")[/versionName = "(.+)"/, 1]
build("assemble", "etchdroid.githubRelease" => true)
sh("gh", "release", "create", "v#{version}", lane_context[SharedValues::GRADLE_APK_OUTPUT_PATH],
apk = output(SharedValues::GRADLE_ALL_APK_OUTPUT_PATHS, "/gplay/release/app-gplay-release.apk")
sh("gh", "release", "create", "v#{version}", apk,
"--draft", "--verify-tag", "--title", "v#{version}", "--generate-notes")
end
end