Skip to content

Commit

Permalink
Improve build file to handle github action commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
MinnDevelopment authored Jun 19, 2023
1 parent 44538cb commit 3ebfac1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ val isCI = System.getProperty("BUILD_NUMBER") != null // jenkins
|| System.getenv("BUILD_NUMBER") != null
|| System.getProperty("GIT_COMMIT") != null // jitpack
|| System.getenv("GIT_COMMIT") != null
|| System.getProperty("GITHUB_ACTIONS") != null // Github Actions
|| System.getenv("GITHUB_ACTIONS") != null
|| System.getProperty("GITHUB_ACTION") != null // Github Actions
|| System.getenv("GITHUB_ACTION") != null

// Check the commit hash and version information
val commitHash: String by lazy {
val commit = System.getenv("GIT_COMMIT") ?: System.getProperty("GIT_COMMIT")
val commit = System.getenv("GIT_COMMIT") ?: System.getProperty("GIT_COMMIT") ?: System.getenv("GITHUB_SHA")
// We only set the commit hash on CI builds since we don't want dirty local repos to set a wrong commit
if (isCI && commit != null)
commit.substring(0, 7)
Expand Down

0 comments on commit 3ebfac1

Please sign in to comment.