Skip to content

Commit 5312c1f

Browse files
authored
fix(build): Set groovyVersion property in joint workflow (#13376)
Currently, CI_GROOVY_VERSION does not make the build properly override the groovy version. This changes the workflow from using CI_GROOVY_VERSION environment variable to overriding groovyVersion property via a Gradle environment variable project property.
1 parent 3048525 commit 5312c1f

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

.github/workflows/groovy-joint-workflow.yml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ on:
2727
workflow_dispatch:
2828
permissions:
2929
contents: read
30-
env:
31-
CI_GROOVY_VERSION:
3230
jobs:
3331
build_groovy:
3432
strategy:
@@ -52,11 +50,10 @@ jobs:
5250
- name: Checkout Groovy 3_0_X (Grails 5 and later)
5351
if: startsWith(github.ref, 'refs/heads/6.') || startsWith(github.base_ref, '6.') || startsWith(github.ref, 'refs/heads/5.') || startsWith(github.base_ref, '5.')
5452
run: cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_3_0_X --single-branch
55-
- name: Set CI_GROOVY_VERSION for Grails
53+
- name: Get Groovy version for Grails
5654
id: groovy-version
5755
run: |
5856
cd ../groovy
59-
echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV
6057
echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT
6158
- name: Prepare GE Set-up Configuration
6259
id: ge_conf
@@ -136,13 +133,11 @@ jobs:
136133
~/groovy
137134
~/.m2/repository
138135
key: cache-local-groovy-maven-${{ github.sha }}
139-
- name: Set CI_GROOVY_VERSION for Grails
140-
run: |
141-
echo "CI_GROOVY_VERSION=${{needs.build_groovy.outputs.groovyVersion}}" >> $GITHUB_ENV
142136
- name: Build Grails
143137
id: build_grails
144138
uses: gradle/gradle-build-action@v2
145139
env:
140+
ORG_GRADLE_PROJECT_groovyVersion: ${{ needs.build_groovy.outputs.groovyVersion }}
146141
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
147142
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
148143
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}

build.gradle

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ apply plugin: 'idea'
2121
ext {
2222
isJava8Compatible = org.gradle.api.JavaVersion.current().isJava8Compatible()
2323
grailsVersion = project.projectVersion
24-
groovyVersion = System.getenv('CI_GROOVY_VERSION') ?: project.groovyVersion
2524
isBuildSnapshot = grailsVersion.endsWith("-SNAPSHOT")
2625
isReleaseVersion = !isBuildSnapshot
2726
isCiBuild = System.getenv().get("CI") as Boolean
@@ -232,14 +231,14 @@ if (isReleaseVersion) {
232231

233232
allprojects {
234233
repositories {
235-
mavenLocal()
234+
mavenLocal() // Used by the Groovy Joint Validation Github workflow after building groovy locally in CI
236235
mavenCentral()
237-
maven { url "https://repo.grails.org/grails/core" }
238-
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
236+
maven { url = "https://repo.grails.org/grails/core" }
237+
maven { url = "https://oss.sonatype.org/content/repositories/snapshots/" } // TODO: Is this still used?
239238
if(groovyVersion.endsWith('-SNAPSHOT')) {
240-
maven {
241-
name 'JFrog OSS snapshot repo'
242-
url 'https://oss.jfrog.org/oss-snapshot-local/'
239+
maven { // Used for testing with Groovy snapshots locally
240+
name = 'Groovy Snapshot repository'
241+
url = 'https://groovy.jfrog.io/artifactory/libs-snapshot-local/'
243242
}
244243
}
245244
}

0 commit comments

Comments
 (0)