Skip to content

Commit

Permalink
Merge #57 into 1.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
violetagg committed Jan 18, 2023
2 parents 3811414 + 057fa86 commit 9c9ad2c
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions gradle/publishing.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2019-2022 VMware Inc. or its affiliates, All Rights Reserved.
* Copyright (c) 2019-2023 VMware Inc. or its affiliates, All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -29,6 +29,24 @@ static def qualifyVersion(String v) {
return "BAD"
}

static def outputToGha(String versionType, String fullVersion) {
def ghaFilename = System.getenv("GITHUB_OUTPUT")
if (ghaFilename == null) {
println "::set-output name=versionType::$versionType"
println "::set-output name=fullVersion::$fullVersion"
}
else {
println "using GITHUB_OUTPUT file"
def ghaFile = new File(ghaFilename)
ghaFile.withWriterAppend {
it.newLine()
it.append("versionType=$versionType")
it.newLine()
it.append("fullVersion=$fullVersion")
}
}
}

configure(rootProject) { subproject ->

apply plugin: 'maven-publish'
Expand Down Expand Up @@ -59,13 +77,18 @@ configure(rootProject) { subproject ->
task qualifyVersionGha() {
doLast {
def versionType = qualifyVersion("$version")

println "::set-output name=versionType::$versionType"
println "::set-output name=fullVersion::$version"
//we ensure that if at least _one_ submodule version is BAD, we only output versionType=BAD + job fails
if (versionType == "BAD") {
outputToGha(versionType, version)
println "::error ::Unable to parse $version to a VersionNumber with recognizable qualifier"
throw new TaskExecutionException(tasks.getByName("qualifyVersionGha"), new IllegalArgumentException("Unable to parse $version to a VersionNumber with recognizable qualifier"))
}
println "Recognized $version as $versionType"

//only output the versionType and fullVersion for the main artifact
if (project.name == 'reactor-kotlin-extensions') {
outputToGha(versionType, version)
}
}
}

Expand Down

0 comments on commit 9c9ad2c

Please sign in to comment.