Skip to content

Commit 7eba020

Browse files
committed
build: Use commit date for version name
1 parent 06b22f9 commit 7eba020

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

.github/workflows/android.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ jobs:
5353
- name: Create AutoBuild Release
5454
run: |
5555
GIT_DESCRIBE=$(git rev-parse --short HEAD)
56+
GIT_COMMIT_DATE=$(git log -1 --format=%cd --date=format:%y%m%d)
5657
cd app/build/outputs/apk/universal/release/
57-
mv app-universal-release.apk ReVancedXposedSpotify-${GIT_DESCRIBE}.apk
58+
mv app-universal-release.apk ReVancedXposedSpotify-${GIT_COMMIT_DATE}.apk
5859
gh release delete autobuild --yes || true
59-
gh release create autobuild ReVancedXposedSpotify-${GIT_DESCRIBE}.apk --prerelease --title "AutoBuild ${GIT_DESCRIBE}" --notes "The package name and signature of this build are different every day."
60+
gh release create autobuild ReVancedXposedSpotify-${GIT_COMMIT_DATE}.apk --latest --title "Build ${GIT_DESCRIBE}" --notes "The package name and signature of this build are different every day. You don't have to reinstall it every day."
6061
env:
6162
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

app/build.gradle.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ val gitCommitHashProvider = providers.exec {
1111
workingDir = rootProject.rootDir
1212
}.standardOutput.asText!!
1313

14+
val gitCommitDateProvider = providers.exec {
15+
commandLine("git log -1 --format=%cd --date=format:%y%m%d".split(' '))
16+
workingDir = rootProject.rootDir
17+
}.standardOutput.asText!!
18+
1419
private val seed = (project.properties["PACKAGE_NAME_SEED"] as? String ?: "0").toLong().also { println("Seed for package name: $it") }
1520
private val myPackageName = genPackageName(seed).also { println("Package name: $it") }
1621

@@ -46,7 +51,7 @@ android {
4651
defaultConfig {
4752
applicationId = myPackageName
4853
versionCode = 33
49-
versionName = "1.0.$versionCode"
54+
versionName = gitCommitDateProvider.get().trim()
5055
buildConfigField("String", "COMMIT_HASH", "\"${gitCommitHashProvider.get().trim()}\"")
5156
}
5257
flavorDimensions += "abi"

0 commit comments

Comments
 (0)