-
-
Save mark-software/e034e326ad3a1b6f110c08fb885cc4a9 to your computer and use it in GitHub Desktop.
Example showing how to read a build number from a CI system for automatic build numbers
This file contains 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 { | |
//version.properties is only used to get the version number from CircleCi | |
def versionFile = file('../.signing/version.properties') | |
def buildNumber = 456 | |
if(versionFile.canRead()) { | |
Properties props = new Properties() | |
props.load(new FileInputStream(versionFile)) | |
//Add skip_appcenter_release in a commit message to develop/master/release if you don't want a build to be created by CircleCi | |
if(props['VERSION_CODE'] != null) { | |
def circleBuildNumber = props['VERSION_CODE'].toInteger() | |
buildNumber = circleBuildNumber - 3870 //subtract offset to get close to our real build number | |
} | |
} | |
defaultConfig { | |
versionCode buildNumber | |
versionName "1.2.3" | |
... | |
} | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment