Last active
November 2, 2021 17:50
-
-
Save JacquesSmuts/537cce9aa3f5d284860a47928344d717 to your computer and use it in GitHub Desktop.
Determining versionCode based on CircleCI build number
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
android { | |
defaultConfig { | |
versionName "1.9.1" | |
versionCode getBuildVersion() as int | |
} | |
} | |
// Don't name this getVersionCode() or things will break | |
static def getBuildVersion() { | |
def version = 123 | |
def buildNumber = System.getenv("CIRCLE_BUILD_NUM") | |
if (buildNumber != null) { | |
version += buildNumber | |
} | |
println("VersionCode: " + version) | |
return version | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment