From fd2187d9208e22c77b512dee5cdbd0dde7f38614 Mon Sep 17 00:00:00 2001 From: Violeta Georgieva Date: Wed, 18 Jan 2023 13:20:49 +0200 Subject: [PATCH 1/3] [chore] Use new GHA API for setting output Related to reactor/reactor#727 --- gradle/publishing.gradle | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index 2a349df..b2e4f9d 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -56,16 +56,39 @@ configure(rootProject) { subproject -> from sourceSets.main.allSource } + 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") + } + } + } + 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) + } } } From f48066cffaa5a741483054e5404016cf7d8c88d3 Mon Sep 17 00:00:00 2001 From: Violeta Georgieva Date: Wed, 18 Jan 2023 13:24:16 +0200 Subject: [PATCH 2/3] Fix copyright header --- gradle/publishing.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index b2e4f9d..501d3de 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -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. From 817dca401be9676313fdc3a0633686e5f799f0ee Mon Sep 17 00:00:00 2001 From: Violeta Georgieva Date: Wed, 18 Jan 2023 13:28:27 +0200 Subject: [PATCH 3/3] In addition to previous change --- gradle/publishing.gradle | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/gradle/publishing.gradle b/gradle/publishing.gradle index 501d3de..e239ef7 100644 --- a/gradle/publishing.gradle +++ b/gradle/publishing.gradle @@ -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' @@ -56,24 +74,6 @@ configure(rootProject) { subproject -> from sourceSets.main.allSource } - 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") - } - } - } - task qualifyVersionGha() { doLast { def versionType = qualifyVersion("$version")