2025-09-09 16:08:11 -05:00
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:android)
platform :android do
desc "Runs all the tests"
lane :test do
gradle(task: "test")
end
desc "Deploy a new version to the internal track on Google Play"
lane :internal do
2025-10-03 09:33:09 -05:00
begin
aab_path = build_google_release
upload_to_play_store(
track: 'internal',
aab: aab_path,
release_status: 'completed',
skip_upload_apk: true,
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true,
)
rescue => exception
if exception.message.include?("Google Api Error: forbidden: A release with version code") && exception.message.include?("already exists for this track")
UI.message("This version code is already on the internal track. No action needed.")
else
raise exception
end
end
2025-09-09 16:08:11 -05:00
end
2025-09-22 10:15:41 -05:00
desc "Promote from internal track to the closed track on Google Play"
2025-09-09 16:08:11 -05:00
lane :closed do
upload_to_play_store(
2025-09-22 10:15:41 -05:00
track: 'internal',
track_promote_to: 'NewAlpha',
2025-10-03 09:33:09 -05:00
version_codes: [ENV["VERSION_CODE"].to_i],
2025-09-09 21:22:24 -05:00
release_status: 'completed',
2025-09-14 10:25:16 -05:00
skip_upload_apk: true,
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true,
2025-09-09 16:08:11 -05:00
)
end
2025-10-03 09:33:09 -05:00
desc "Promote from internal track to the open track on Google Play"
2025-09-09 16:08:11 -05:00
lane :open do
upload_to_play_store(
2025-10-03 09:33:09 -05:00
track: 'internal',
2025-09-22 10:15:41 -05:00
track_promote_to: 'beta',
2025-10-03 09:33:09 -05:00
version_codes: [ENV["VERSION_CODE"].to_i],
2025-09-10 08:29:18 -05:00
release_status: 'draft',
2025-09-14 10:29:55 -05:00
skip_upload_apk: true,
2025-09-14 10:25:16 -05:00
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true,
2025-09-09 16:08:11 -05:00
)
end
2025-10-03 09:33:09 -05:00
desc "Promote from internal track to the production track on Google Play"
2025-09-09 16:08:11 -05:00
lane :production do
upload_to_play_store(
2025-10-03 09:33:09 -05:00
track: 'internal',
2025-09-22 10:15:41 -05:00
track_promote_to: 'production',
2025-10-03 09:33:09 -05:00
version_codes: [ENV["VERSION_CODE"].to_i],
2025-09-09 21:22:24 -05:00
release_status: 'draft',
2025-09-14 10:29:55 -05:00
skip_upload_apk: true,
2025-09-14 10:25:16 -05:00
skip_upload_metadata: true,
skip_upload_changelogs: true,
skip_upload_images: true,
skip_upload_screenshots: true,
2025-09-09 16:08:11 -05:00
)
end
desc "Build the F-Droid release"
lane :fdroid_build do
gradle(
task: "clean assembleFdroidRelease",
properties: {
"android.injected.version.name" => ENV['VERSION_NAME'],
"android.injected.version.code" => ENV['VERSION_CODE']
}
)
end
2025-10-03 09:33:09 -05:00
desc "Get the highest version code from all Google Play tracks"
lane :get_highest_version_code do
require 'set'
all_codes = Set.new
2025-10-03 10:46:31 -05:00
tracks = ['internal', 'alpha', 'beta', 'production']
2025-10-03 09:33:09 -05:00
tracks.each do |track|
begin
2025-10-03 10:46:31 -05:00
codes = google_play_track_version_codes(track: track)
all_codes.merge(codes.map(&:to_i)) if codes
2025-10-03 09:33:09 -05:00
rescue => e
UI.message("Could not fetch version codes for track #{track}: #{e.message}")
end
end
highest = all_codes.max || 0
UI.message("Highest version code on Google Play: #{highest}")
File.write('highest_version_code.txt', highest.to_s)
end
2025-09-09 16:08:11 -05:00
private_lane :build_google_release do
gradle(
task: "clean bundleGoogleRelease assembleGoogleRelease",
print_command: false,
properties: {
"android.injected.version.name" => ENV['VERSION_NAME'],
"android.injected.version.code" => ENV['VERSION_CODE']
}
)
2025-09-09 20:49:16 -05:00
lane_context[SharedValues::GRADLE_AAB_OUTPUT_PATH]
2025-09-09 16:08:11 -05:00
end
end