Skip to content

Commit

Permalink
refactor(CD): simplify task
Browse files Browse the repository at this point in the history
  • Loading branch information
otahirs authored Sep 12, 2024
1 parent dd3caa1 commit 9158395
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions backend/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -146,16 +146,7 @@ openApiGenerate {
tasks.compileJava.get().dependsOn(tasks.openApiGenerate)

tasks.getByName<BootBuildImage>("bootBuildImage") {
// Get the tag from the environment or use the commit hash if tag is empty
val gitTag = System.getenv("GIT_TAG")
val commitHash = System.getenv("GIT_COMMIT_HASH")

// Set the image name based on tag or commit hash
imageName = if (StringUtils.isNotBlank(gitTag)) {
"ghcr.io/${System.getenv("GITHUB_REPOSITORY")}:$gitTag"
} else {
"ghcr.io/${System.getenv("GITHUB_REPOSITORY")}:$commitHash"
}
imageName = "ghcr.io/${System.getenv("GITHUB_REPOSITORY")}:" + version
publish = StringUtils.isNotBlank(System.getenv("GITHUB_TOKEN"))
docker {
publishRegistry {
Expand All @@ -167,3 +158,4 @@ tasks.getByName<BootBuildImage>("bootBuildImage") {
}
}


0 comments on commit 9158395

Please sign in to comment.