Skip to content

Commit ec7dbf8

Browse files
committed
fastlane: check version code is incremented before building for production
1 parent c7623f2 commit ec7dbf8

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

fastlane/Fastfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ lane :production do
2929
version_code = get_properties_value(key: "VERSION_CODE", path: "./app/version.properties")
3030
version_name = get_properties_value(key: "VERSION_NAME", path: "./app/version.properties")
3131

32+
live_version_codes = google_play_track_version_codes()
33+
latest_live_version_code = live_version_codes.max || 0
34+
35+
if version_code.to_i <= latest_live_version_code
36+
UI.user_error!("VERSION_CODE (#{version_code}) in app/version.properties must be greater than the latest closed track version code (#{latest_live_version_code}).")
37+
end
38+
3239
# Don't create changelog for f-droid because not committing it
3340
# File.write("metadata/android/en-US/changelogs/" + version_code + ".txt", whats_new)
3441

@@ -96,6 +103,13 @@ lane :internal do
96103
version_code = get_properties_value(key: "VERSION_CODE", path: "./app/version.properties")
97104
version_name = get_properties_value(key: "VERSION_NAME", path: "./app/version.properties")
98105

106+
live_version_codes = google_play_track_version_codes(track: "alpha")
107+
latest_live_version_code = live_version_codes.max || 0
108+
109+
if version_code.to_i <= latest_live_version_code
110+
UI.user_error!("VERSION_CODE (#{version_code}) in app/version.properties must be greater than the latest closed track version code (#{latest_live_version_code}).")
111+
end
112+
99113
# Check Rust formatting and run tests
100114
Dir.chdir("../evdev/src/main/rust/evdev_manager") do
101115
sh("cargo fmt --check")

0 commit comments

Comments
 (0)