diff --git a/.github/workflows/build-gradle-project.yml b/.github/workflows/build-gradle-project.yml index 27658b5..b9ee9a8 100644 --- a/.github/workflows/build-gradle-project.yml +++ b/.github/workflows/build-gradle-project.yml @@ -42,8 +42,8 @@ jobs: if: steps.branch-names.outputs.current_branch == 'develop' run: | docker push "kingstonduo/pegasus-data:$IMAGE_TAG" - + - name: Push to Docker Hub if branch is not develop - if: ${{ !steps.branch-names.outputs.current_branch == 'develop' }} + if: steps.branch-names.outputs.current_branch != 'develop' run: | docker push "kingstonduo/pegasus-data:${{ steps.branch-names.outputs.current_branch }}" diff --git a/build.gradle b/build.gradle index 9c41ac3..b66757b 100755 --- a/build.gradle +++ b/build.gradle @@ -59,12 +59,12 @@ task unpack(type: Copy) { into("build/dependency") } -def getTagInfo() { - if (project.hasProperty('tag')) { - def tagValue = project.property('tag') - return tagValue - } else { - def gitBranch = "Unknown branch" +def getCurrentGitBranch() { + if (project.hasProperty('tag')) { + def tagValue = project.property('tag') + return tagValue + } else { + def gitBranch = "Unknown branch" try { def workingDir = new File("${project.projectDir}") def result = 'git rev-parse --abbrev-ref HEAD'.execute(null, workingDir) @@ -74,8 +74,8 @@ def getTagInfo() { } } catch (e) { } - if (gitBranch == "develop" || gitBranch == "master"){ - return "${jar.version}" + if (gitBranch == "develop" || gitBranch == "master"){ + return jar.version }else{ return gitBranch } @@ -83,7 +83,7 @@ def getTagInfo() { } docker { - name "${project.group}/${jar.baseName}:" + getTagInfo() + name "kingstonduo/${jar.baseName}:" + getCurrentGitBranch() copySpec.from(tasks.unpack.outputs).into("dependency") buildArgs(['DEPENDENCY': "dependency"]) }