Skip to content

Instantly share code, notes, and snippets.

@lukebrandonfarrell
Created February 22, 2021 10:50
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukebrandonfarrell/18860f9e88b099b77ef137068e945d5b to your computer and use it in GitHub Desktop.
Save lukebrandonfarrell/18860f9e88b099b77ef137068e945d5b to your computer and use it in GitHub Desktop.
Gets the latest Google Play version code using Fastlane google_play_track_version_codes
def latest_googleplay_version_code
productionVersionCodes = google_play_track_version_codes(track: 'production')
betaVersionCodes = google_play_track_version_codes(track: 'beta')
alphaVersionCodes = google_play_track_version_codes(track: 'alpha')
internalVersionCodes = google_play_track_version_codes(track: 'internal')
# puts version codes from all tracks into the same array
versionCodes = [
productionVersionCodes,
betaVersionCodes,
alphaVersionCodes,
internalVersionCodes
].reduce([], :concat)
# returns the highest version code from array
return versionCodes.max
end
@lukebrandonfarrell
Copy link
Author

Usage:

version_code = latest_googleplay_version_code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment