Last active
August 29, 2015 14:25
-
-
Save alexfu/27715c8a1891085adbd2 to your computer and use it in GitHub Desktop.
Examples of how to streamline releases with your Gradle based Android project
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
/** | |
* This example demonstrates how to create a build task | |
* for publishing a beta to HockeyApp in addition to | |
* tagging and pushing a beta release to your remote git | |
* repo using the gradle-git plugin. | |
*/ | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'org.ajoberstar:gradle-git:1.2.0' | |
classpath 'de.felixschulze.gradle:gradle-hockeyapp-plugin:3.0.1' | |
} | |
} | |
apply plugin: 'org.ajoberstar.grgit' | |
apply plugin: 'de.felixschulze.gradle.hockeyapp' | |
android { | |
... | |
} | |
hockeyapp { | |
... | |
} | |
tasks.whenTaskAdded { task -> | |
if (task.name.equals("uploadBetaToHockeyApp")) { | |
tasks.releaseBeta.dependsOn task | |
} | |
} | |
task releaseBeta << { | |
// Ex: v1.2.3.45 | |
def tagName = "v${android.defaultConfig.versionName}.${android.defaultConfig.versionCode}" | |
grgit.tag.add(name: tagName, message: "Beta release ${tagName}") | |
grgit.push(refsOrSpecs: [tagName]) | |
} |
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
/** | |
* This example demonstrates how to create a build task | |
* for tagging and pushing a beta release to your remote | |
* git repo using the gradle-git plugin. | |
*/ | |
buildscript { | |
repositories { | |
jcenter() | |
} | |
dependencies { | |
classpath 'org.ajoberstar:gradle-git:1.2.0' | |
} | |
} | |
apply plugin: 'org.ajoberstar.grgit' | |
android { | |
... | |
} | |
task releaseBeta << { | |
// Ex: v1.2.3.45 | |
def tagName = "v${android.defaultConfig.versionName}.${android.defaultConfig.versionCode}" | |
grgit.tag.add(name: tagName, message: "Beta release ${tagName}") | |
grgit.push(refsOrSpecs: [tagName]) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment