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.

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])
}

Comments

Popular posts from this blog

How to build unlimited levels menu through PHP and MySQL

How to build a map of the frequency with which characters occur in a file in OCaml?

How to create timed pop-up windows using MVVM?