Skip to content

Instantly share code, notes, and snippets.

@JacquesSmuts
Last active November 2, 2021 17:50
Show Gist options
  • Save JacquesSmuts/537cce9aa3f5d284860a47928344d717 to your computer and use it in GitHub Desktop.
Save JacquesSmuts/537cce9aa3f5d284860a47928344d717 to your computer and use it in GitHub Desktop.
Determining versionCode based on CircleCI build number
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