Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KPMP-5355: fix build action #132

Merged
merged 1 commit into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"])
}
Loading