@@ -43,7 +43,7 @@ class SimpleIntegrationTest extends BaseIntegrationTest {
43
43
def " should set released-version github output after release task" (String task,
44
44
String rootProjectVersion,
45
45
String subprojectVersion,
46
- String output) {
46
+ List< String > output) {
47
47
given :
48
48
def outputFile = File . createTempFile(" github-outputs" , " .tmp" )
49
49
environmentVariablesRule. set(" GITHUB_ACTIONS" , " true" )
@@ -91,23 +91,23 @@ class SimpleIntegrationTest extends BaseIntegrationTest {
91
91
92
92
then :
93
93
def definedEnvVariables = outputFile. getText(). lines(). collect(toList())
94
- definedEnvVariables. contains( output)
94
+ definedEnvVariables == output
95
95
96
96
cleanup :
97
97
environmentVariablesRule. clear(" GITHUB_ACTIONS" , " GITHUB_OUTPUT" )
98
98
99
99
where :
100
100
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' ]
105
105
}
106
106
107
107
def " should set published-version github output after publish task" (String task,
108
108
String rootProjectVersion,
109
109
String subprojectVersion,
110
- String output) {
110
+ List< String > output) {
111
111
given :
112
112
def outputFile = File . createTempFile(" github-outputs" , " .tmp" )
113
113
environmentVariablesRule. set(" GITHUB_ACTIONS" , " true" )
@@ -145,17 +145,59 @@ class SimpleIntegrationTest extends BaseIntegrationTest {
145
145
146
146
then :
147
147
def definedEnvVariables = outputFile. getText(). lines(). collect(toList())
148
- definedEnvVariables. contains( output)
148
+ definedEnvVariables == output
149
149
150
150
cleanup :
151
151
environmentVariablesRule. clear(" GITHUB_ACTIONS" , " GITHUB_OUTPUT" )
152
152
153
153
where :
154
154
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" )
159
201
}
160
202
161
203
def " should return released version on calling cV on repo with release commit" () {
0 commit comments