From 4b67de7311a27be4172c9f81942412abdc031cb8 Mon Sep 17 00:00:00 2001 From: Marten Gajda Date: Thu, 8 Nov 2018 17:41:14 +0100 Subject: [PATCH] Auto-Determine release channel, implements #725 (#726) Update the publish configuration to derive the publishing track form the version number. --- build.gradle | 2 +- opentasks/build.gradle | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 82956f983..93e317a99 100644 --- a/build.gradle +++ b/build.gradle @@ -14,7 +14,7 @@ buildscript { def gitVersion = { -> def stdout = new ByteArrayOutputStream() exec { - commandLine 'git', 'describe', '--tags', '--always' + commandLine 'git', 'describe', '--tags', '--always', '--dirty' standardOutput = stdout } return stdout.toString().trim() diff --git a/opentasks/build.gradle b/opentasks/build.gradle index 0acdc0e0b..39cf6c9fc 100644 --- a/opentasks/build.gradle +++ b/opentasks/build.gradle @@ -95,5 +95,22 @@ dependencies { if (project.hasProperty('PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS')) { play { serviceAccountCredentials = file(PLAY_STORE_SERVICE_ACCOUNT_CREDENTIALS) + // the track is determined automatically by the version number format + switch (version){ + case ~/^(\d+)(\.\d+)*-\d+-[\w\d]+-dirty$/: + // work in progress goes to the internal track + track = "internal" + break + case ~/^(\d+)(\.\d+)*-\d+-[\w\d]+$/: + // untagged commits go to alpha + track = "alpha" + break + case ~/^(\d+)(\.\d+)*$/: + // tagged commits to go beta, from where they get promoted to releases + track = "beta" + break + default: + throw new IllegalArgumentException("Unrecognized version format") + } } } \ No newline at end of file