|
1 | 1 | /* |
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. |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
@@ -51,16 +51,39 @@ task javadocJar(type: Jar) { |
51 | 51 | from '../NOTICE' |
52 | 52 | } |
53 | 53 |
|
| 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 | + |
54 | 72 | task qualifyVersionGha() { |
55 | 73 | doLast { |
56 | 74 | 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 |
60 | 76 | if (versionType == "BAD") { |
| 77 | + outputToGha(versionType, version) |
61 | 78 | println "::error ::Unable to parse $version to a VersionNumber with recognizable qualifier" |
62 | 79 | throw new TaskExecutionException(tasks.getByName("qualifyVersionGha"), new IllegalArgumentException("Unable to parse $version to a VersionNumber with recognizable qualifier")) |
63 | 80 | } |
| 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 | + } |
64 | 87 | } |
65 | 88 | } |
66 | 89 |
|
|
0 commit comments