From 14af534a590ba71ecbd3ff407c9f0f7239c40f7b Mon Sep 17 00:00:00 2001 From: Davide Depau Date: Wed, 4 Nov 2026 19:15:04 +0100 Subject: [PATCH] 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. --- fastlane/Fastfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 2fe9aeb..6b0bc0c 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -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