@@ -43,7 +43,7 @@ class SimpleIntegrationTest extends BaseIntegrationTest {
4343 def " should set released-version github output after release task" (String task,
4444 String rootProjectVersion,
4545 String subprojectVersion,
46- String output) {
46+ List< String > output) {
4747 given :
4848 def outputFile = File . createTempFile(" github-outputs" , " .tmp" )
4949 environmentVariablesRule. set(" GITHUB_ACTIONS" , " true" )
@@ -91,23 +91,23 @@ class SimpleIntegrationTest extends BaseIntegrationTest {
9191
9292 then :
9393 def definedEnvVariables = outputFile. getText(). lines(). collect(toList())
94- definedEnvVariables. contains( output)
94+ definedEnvVariables == output
9595
9696 cleanup :
9797 environmentVariablesRule. clear(" GITHUB_ACTIONS" , " GITHUB_OUTPUT" )
9898
9999 where :
100100 task | rootProjectVersion | subprojectVersion || output
101- ' release' | " 1.0.0" | " 1.0.0" || ' released-version=1.0.1'
102- ' release' | " 1.0.0" | " 2.0.0" || ' released-version={"root-project":"1.0.1","sub-project":"2.0.1"}'
103- ' :release' | " 1.0.0" | " 2.0.0" || ' released-version=1.0.1'
104- ' :sub-project:release' | " 1.0.0" | " 2.0.0" || ' released-version=2.0.1'
101+ ' release' | " 1.0.0" | " 1.0.0" || [ ' released-version=1.0.1' ]
102+ ' release' | " 1.0.0" | " 2.0.0" || [ ' released-version={"root-project":"1.0.1","sub-project":"2.0.1"}' ]
103+ ' :release' | " 1.0.0" | " 2.0.0" || [ ' released-version=1.0.1' ]
104+ ' :sub-project:release' | " 1.0.0" | " 2.0.0" || [ ' released-version=2.0.1' ]
105105 }
106106
107107 def " should set published-version github output after publish task" (String task,
108108 String rootProjectVersion,
109109 String subprojectVersion,
110- String output) {
110+ List< String > output) {
111111 given :
112112 def outputFile = File . createTempFile(" github-outputs" , " .tmp" )
113113 environmentVariablesRule. set(" GITHUB_ACTIONS" , " true" )
@@ -145,17 +145,59 @@ class SimpleIntegrationTest extends BaseIntegrationTest {
145145
146146 then :
147147 def definedEnvVariables = outputFile. getText(). lines(). collect(toList())
148- definedEnvVariables. contains( output)
148+ definedEnvVariables == output
149149
150150 cleanup :
151151 environmentVariablesRule. clear(" GITHUB_ACTIONS" , " GITHUB_OUTPUT" )
152152
153153 where :
154154 task | rootProjectVersion | subprojectVersion || output
155- ' publish' | " 1.0.0" | " 1.0.0" || ' published-version=1.0.0'
156- ' publish' | " 1.0.0" | " 2.0.0" || ' published-version={"root-project":"1.0.0","sub-project":"2.0.0"}'
157- ' :publish' | " 1.0.0" | " 2.0.0" || ' published-version=1.0.0'
158- ' :sub-project:publish' | " 1.0.0" | " 2.0.0" || ' published-version=2.0.0'
155+ ' publish' | " 1.0.0" | " 1.0.0" || [' published-version=1.0.0' ]
156+ ' publish' | " 1.0.0" | " 2.0.0" || [' published-version={"root-project":"1.0.0","sub-project":"2.0.0"}' ]
157+ ' :publish' | " 1.0.0" | " 2.0.0" || [' published-version=1.0.0' ]
158+ ' :sub-project:publish' | " 1.0.0" | " 2.0.0" || [' published-version=2.0.0' ]
159+ }
160+
161+ def " should set published-version github output even if root project does not apply maven-publish" () {
162+ given :
163+ def outputFile = File . createTempFile(" github-outputs" , " .tmp" )
164+ environmentVariablesRule. set(" GITHUB_ACTIONS" , " true" )
165+ environmentVariablesRule. set(" GITHUB_OUTPUT" , outputFile. getAbsolutePath())
166+
167+ vanillaSettingsFile("""
168+ rootProject.name = 'root-project'
169+
170+ include 'sub-project'
171+ """
172+ )
173+
174+ vanillaBuildFile("""
175+ plugins {
176+ id 'pl.allegro.tech.build.axion-release'
177+ }
178+
179+ allprojects {
180+ version = '1.0.0'
181+ }
182+ """
183+ )
184+
185+ vanillaSubprojectBuildFile(" sub-project" , """
186+ plugins {
187+ id 'maven-publish'
188+ }
189+ """
190+ )
191+
192+ when :
193+ runGradle(' publish' )
194+
195+ then :
196+ def definedEnvVariables = outputFile. getText(). lines(). collect(toList())
197+ definedEnvVariables == [' published-version=1.0.0' ]
198+
199+ cleanup :
200+ environmentVariablesRule. clear(" GITHUB_ACTIONS" , " GITHUB_OUTPUT" )
159201 }
160202
161203 def " should return released version on calling cV on repo with release commit" () {
0 commit comments