Skip to content

Commit

Permalink
Merge pull request #132 from KPMP/KPMP-5355_fix_build_action
Browse files Browse the repository at this point in the history
KPMP-5355: fix build action
  • Loading branch information
rlreamy authored May 20, 2024
2 parents 452fa9c + 24e4f60 commit 28e4720
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-gradle-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -74,16 +74,16 @@ def getTagInfo() {
}
} catch (e) {
}
if (gitBranch == "develop" || gitBranch == "master"){
return "${jar.version}"
if (gitBranch == "develop" || gitBranch == "master"){
return jar.version
}else{
return gitBranch
}
}
}

docker {
name "${project.group}/${jar.baseName}:" + getTagInfo()
name "kingstonduo/${jar.baseName}:" + getCurrentGitBranch()
copySpec.from(tasks.unpack.outputs).into("dependency")
buildArgs(['DEPENDENCY': "dependency"])
}

0 comments on commit 28e4720

Please sign in to comment.