aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2025-05-11 11:50:09 +0300
committerAndrew Dolgov <fox@fakecake.org>2025-05-11 11:50:09 +0300
commit712afbcd5a9700f3bc58b7bbfb471af5ca74cf5b (patch)
treece4b05b78a609d00ca1f32ecdf4f07aafbba2d1b
parent265b703a516aa0e8a078856b6ecf3faa0a65490d (diff)
set version code to increment once a day based on git commit instead of dealing with it manually
-rwxr-xr-xorg.fox.ttrss/build.gradle14
1 files changed, 11 insertions, 3 deletions
diff --git a/org.fox.ttrss/build.gradle b/org.fox.ttrss/build.gradle
index be621d57..887890b6 100755
--- a/org.fox.ttrss/build.gradle
+++ b/org.fox.ttrss/build.gradle
@@ -13,7 +13,7 @@ android {
//noinspection ExpiredTargetSdkVersion
targetSdkVersion 31
compileSdk 35
- versionCode 563
+ versionCode getGitVersionCode()
versionName getVersion()
vectorDrawables.useSupportLibrary = true
}
@@ -55,6 +55,14 @@ android {
}
}
+def getGitVersionCode() {
+ return new Date(getGitTimestamp()).format('yyyyMMdd').toInteger()
+}
+
+def getGitTimestampFormatted() {
+ return new Date(getGitTimestamp()).format('YY.MM')
+}
+
def getGitTimestamp() {
// gitlab CI iso-8601 timestamp
if (System.getenv("CI_COMMIT_TIMESTAMP")) {
@@ -69,7 +77,7 @@ def getGitTimestamp() {
standardOutput = stdout
}
- return new Date(stdout.toString().trim().toLong() * 1000).format('YY.MM')
+ return stdout.toString().trim().toLong() * 1000;
}
catch (ignored) {
return 0;
@@ -97,7 +105,7 @@ def getGitCommitHash() {
}
def getVersion() {
- return getGitTimestamp() + '-' + getGitCommitHash();
+ return getGitTimestampFormatted() + '-' + getGitCommitHash();
}
dependencies {