Skip to content

Commit

Permalink
Fix branch publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaldassari committed Aug 3, 2023
1 parent 2feb59b commit dbb4469
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ jobs:
run: ./gradlew test --console plain

- name: Publish artifacts
run: ./gradlew publish
run: ./gradlew publish -x test -Pbranch="$GITHUB_HEAD_REF"
14 changes: 4 additions & 10 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,13 @@ ext {
baseVersion = '1.0.0'

getBranch = {
return "${System.getenv('GITHUB_HEAD_REF') ?: ''}"
return project.findProperty('branch') ?: ''
}

getUsername = {
return System.properties['user.name']
}

determineProjectVersion = { baseVersion, branch, username ->
determineProjectVersion = { baseVersion, branch ->
projectVersion = baseVersion
if (!branch.equals("main")) {
if (branch.isEmpty()) {
projectVersion = "${projectVersion}-${username}"
} else {
if (!branch.isEmpty()) {
projectVersion = "${projectVersion}-${branch}"
}
projectVersion = "${projectVersion}-SNAPSHOT"
Expand All @@ -37,7 +31,7 @@ ext {

group = 'com.mabl'
archivesBaseName = 'pac-interpreter'
version = determineProjectVersion(baseVersion, getBranch(), getUsername())
version = determineProjectVersion(baseVersion, getBranch())

java {
toolchain {
Expand Down

0 comments on commit dbb4469

Please sign in to comment.