-
-
Save morristech/625b0ebc1bfa5ce8752ebb2479890822 to your computer and use it in GitHub Desktop.
Auto increment version number on release builds... You can change the build type on versionCode.gradle, you also will need to commit and push gradle.properties on your CI
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
| apply from: 'versionCode.gradle' | |
| android { | |
| defaultConfig { | |
| versionName VERSION_NAME | |
| versionCode Integer.parseInt(VERSION_CODE) | |
| } | |
| } |
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
| VERSION_NAME=1.0.0 | |
| VERSION_CODE=10 |
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
| task('increaseVersionCode') << { | |
| def versionCode = Integer.parseInt(VERSION_CODE) + 1 | |
| ant.propertyfile(file: "../gradle.properties") { | |
| entry(key: "VERSION_CODE", value: versionCode) | |
| } | |
| } | |
| tasks.whenTaskAdded { task -> | |
| if (task.name == 'generateReleaseBuildConfig) { | |
| task.dependsOn 'increaseVersionCode' | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment