Skip to content
This repository was archived by the owner on Sep 26, 2025. It is now read-only.

Commit 2bba751

Browse files
authored
[chore] Use new GHA API for setting output (#179)
Related to reactor/reactor#727
1 parent 11e3a50 commit 2bba751

File tree

1 file changed

+27
-4
lines changed

1 file changed

+27
-4
lines changed

gradle/setup.gradle

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017-2021 VMware Inc. or its affiliates, All Rights Reserved.
2+
* Copyright (c) 2017-2023 VMware Inc. or its affiliates, All Rights Reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -51,16 +51,39 @@ task javadocJar(type: Jar) {
5151
from '../NOTICE'
5252
}
5353

54+
static def outputToGha(String versionType, String fullVersion) {
55+
def ghaFilename = System.getenv("GITHUB_OUTPUT")
56+
if (ghaFilename == null) {
57+
println "::set-output name=versionType::$versionType"
58+
println "::set-output name=fullVersion::$fullVersion"
59+
}
60+
else {
61+
println "using GITHUB_OUTPUT file"
62+
def ghaFile = new File(ghaFilename)
63+
ghaFile.withWriterAppend {
64+
it.newLine()
65+
it.append("versionType=$versionType")
66+
it.newLine()
67+
it.append("fullVersion=$fullVersion")
68+
}
69+
}
70+
}
71+
5472
task qualifyVersionGha() {
5573
doLast {
5674
def versionType = qualifyVersion("$version")
57-
58-
println "::set-output name=versionType::$versionType"
59-
println "::set-output name=fullVersion::$version"
75+
//we ensure that if at least _one_ submodule version is BAD, we only output versionType=BAD + job fails
6076
if (versionType == "BAD") {
77+
outputToGha(versionType, version)
6178
println "::error ::Unable to parse $version to a VersionNumber with recognizable qualifier"
6279
throw new TaskExecutionException(tasks.getByName("qualifyVersionGha"), new IllegalArgumentException("Unable to parse $version to a VersionNumber with recognizable qualifier"))
6380
}
81+
println "Recognized $version as $versionType"
82+
83+
//only output the versionType and fullVersion for the main artifact
84+
if (project.name == 'reactor-rabbitmq') {
85+
outputToGha(versionType, version)
86+
}
6487
}
6588
}
6689

0 commit comments

Comments
 (0)