Skip to content

Commit

Permalink
Append the git hash to the apk name
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Oct 11, 2024
1 parent eeb7f29 commit ac6ba74
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/custom-app-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ env.JELLYFIN_VERSION }}-${{ env.GIT_HASH }}
name: v${{ env.JELLYFIN_VERSION }}
name: v${{ env.JELLYFIN_VERSION }}-${{ env.GIT_HASH }}
files: app/build/outputs/apk/release/*.apk

- name: Upload package to Discord
Expand All @@ -94,7 +94,7 @@ jobs:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
args: |
app/build/outputs/apk/release/jellyfin-androidtv-v${{ env.JELLYFIN_VERSION }}-release.apk
app/build/outputs/apk/release/jellyfin-androidtv-v${{ env.JELLYFIN_VERSION }}-${{ env.GIT_HASH }}-release.apk
- name: Purge build cache
continue-on-error: true
Expand Down
17 changes: 17 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import com.android.build.gradle.internal.api.BaseVariantOutputImpl
import java.io.ByteArrayOutputStream

plugins {
id("com.android.application")
kotlin("android")
Expand All @@ -6,6 +9,15 @@ plugins {
alias(libs.plugins.aboutlibraries)
}

val gitCommitHash: String by lazy {
val stdout = ByteArrayOutputStream()
rootProject.exec {
commandLine("git", "rev-parse", "--verify", "--short", "HEAD")
standardOutput = stdout
}
stdout.toString().trim()
}

android {
namespace = "org.jellyfin.androidtv"
compileSdk = libs.versions.android.compileSdk.get().toInt()
Expand Down Expand Up @@ -73,6 +85,11 @@ android {
testOptions.unitTests.all {
it.useJUnitPlatform()
}

this.buildOutputs.all {
val variantOutputImpl = this as BaseVariantOutputImpl
variantOutputImpl.outputFileName = variantOutputImpl.outputFileName.replace("-release", "-${gitCommitHash}-release")
}
}

aboutLibraries {
Expand Down

0 comments on commit ac6ba74

Please sign in to comment.