Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,73 @@ platform :android do
UI.message("version_number: #{latest_version_number}")
end

desc "Get the version that's actually live/published to users on Google Play"
lane :getLivePlayStoreVersion do |options|
package_name = options[:package_name]
track = options[:track]

# Determine credentials file based on package name
case package_name
when "com.x8bit.bitwarden", "com.x8bit.bitwarden.beta"
json_key = "secrets/play_creds.json"
when "com.bitwarden.authenticator"
json_key = "secrets/authenticator_play_store-creds.json"
else
UI.important "Unexpected package name: #{package_name}, using default play store json key"
json_key = "secrets/play_creds.json"
end

# Use supply to get detailed release status
require 'supply'
require 'supply/options'

Supply.config = FastlaneCore::Configuration.create(
Supply::Options.available_options,
{
package_name: package_name,
track: track,
json_key: json_key
}
)

client = Supply::Client.make_from_config

# Begin edit to access track information
client.begin_edit(package_name: package_name)
tracks = client.tracks(track)
track_obj = tracks.first
client.abort_current_edit

# Check if there's a completed release (status "completed" means it's live)
# With managed publishing, only completed releases are actually available to users
if track_obj && track_obj.releases
completed_release = track_obj.releases.find { |r| r.status == "completed" }

if completed_release && completed_release.version_codes && !completed_release.version_codes.empty?
# Get the highest version code from the completed release
live_version_code = completed_release.version_codes.max

# Get the corresponding version name from the release
live_version_name = completed_release.name

UI.message("Live version_name: #{live_version_name}")
UI.message("Live version_number: #{live_version_code}")

# Output in the same format as getLatestPlayStoreVersion for compatibility
UI.message("version_name: #{live_version_name}")
UI.message("version_number: #{live_version_code}")
else
UI.message("No completed release found on track: #{track}")
UI.message("version_name: ")
UI.message("version_number: ")
end
else
UI.message("No releases found on track: #{track}")
UI.message("version_name: ")
UI.message("version_number: ")
end
end

desc "Assemble debug variants"
lane :buildAuthenticatorDebug do
gradle(
Expand Down
Loading