Skip to content

Commit

Permalink
Improve Version Code Identification
Browse files Browse the repository at this point in the history
  • Loading branch information
PSchmiedmayer committed Dec 6, 2024
1 parent 2e3f344 commit 04f5926
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,24 @@ platform :android do
UI.message("Using environment: #{environment}")
UI.message("Using application id: #{applicationid}")

version_codes = google_play_track_version_codes(
package_name: applicationid,
track: track,
json_key_data: ENV['SERVICE_ACCOUNT_JSON_KEY']
)
def fetch_max_version_code(track, applicationid)
version_codes = google_play_track_version_codes(
package_name: applicationid,
track: track,
json_key_data: ENV['SERVICE_ACCOUNT_JSON_KEY']
)

if version_codes.nil? || version_codes.empty?
previous_version_code = 0
else
previous_version_code = version_codes.max
if version_codes.nil? || version_codes.empty?
0
else
version_codes.max
end
end

production_version_code = fetch_max_version_code('production', applicationid)
internal_version_code = fetch_max_version_code('internal', applicationid)

previous_version_code = [production_version_code, internal_version_code].max
current_version_code = previous_version_code + 1

UI.message("Previous version code: #{previous_version_code}")
Expand Down

0 comments on commit 04f5926

Please sign in to comment.