Skip to content
This repository was archived by the owner on Oct 11, 2025. It is now read-only.

Commit 2c68b17

Browse files
authored
Merge pull request #137 from grails/jamesfredley/update-github-workflows
Update github workflows
2 parents b2b02b7 + ebb09ba commit 2c68b17

File tree

3 files changed

+63
-94
lines changed

3 files changed

+63
-94
lines changed

.github/workflows/gradle.yml

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,37 @@ on:
66
pull_request:
77
branches:
88
- '[5-9]+.[0-9]+.x'
9-
109
jobs:
11-
1210
build_project:
1311
name: Build Project
1412
runs-on: ubuntu-latest
15-
1613
strategy:
1714
fail-fast: true
18-
matrix:
19-
java: [11, 17]
20-
2115
steps:
22-
2316
- uses: actions/checkout@v4
2417
- uses: gradle/wrapper-validation-action@v2
2518
- uses: actions/setup-java@v4
2619
with:
2720
distribution: temurin
28-
java-version: ${{ matrix.java }}
21+
java-version: 17
2922
- name: Run Gradle build
3023
uses: gradle/actions/setup-gradle@v3
3124
env:
3225
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
3326
with:
3427
arguments: build
35-
3628
publish_documentation:
3729
name: Publish Snapshot release
3830
runs-on: ubuntu-latest
3931
if: github.event_name == 'push'
4032
needs: build_project
41-
4233
steps:
43-
4434
- uses: actions/checkout@v4
4535
- uses: gradle/wrapper-validation-action@v2
4636
- uses: actions/setup-java@v4
47-
with: { distribution: temurin, java-version: 11 }
48-
37+
with:
38+
distribution: temurin
39+
java-version: 17
4940
- name: Publish to Artifactory (repo.grails.org)
5041
uses: gradle/actions/setup-gradle@v3
5142
env:
@@ -56,15 +47,13 @@ jobs:
5647
arguments: |
5748
-Dorg.gradle.internal.publish.checksums.insecure=true
5849
publish
59-
6050
- name: Generate Documentation
6151
if: success()
6252
uses: gradle/actions/setup-gradle@v3
6353
env:
6454
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
6555
with:
6656
arguments: docs
67-
6857
- name: Publish to Github Pages
6958
if: success()
7059
uses: micronaut-projects/github-pages-deploy-action@grails
@@ -74,5 +63,5 @@ jobs:
7463
BRANCH: gh-pages
7564
FOLDER: docs/build/docs
7665
DOC_FOLDER: gh-pages
77-
COMMIT_EMAIL: [email protected]
78-
COMMIT_NAME: Puneet Behl
66+
COMMIT_EMAIL: '[email protected]'
67+
COMMIT_NAME: 'grails-build'

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

Lines changed: 50 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ on:
99
workflow_dispatch:
1010
permissions:
1111
contents: read
12+
env:
13+
CI_GROOVY_VERSION:
1214
jobs:
1315
build_groovy:
16+
strategy:
17+
fail-fast: true
1418
runs-on: ubuntu-latest
1519
outputs:
16-
groovySnapshotVersion: ${{ steps.groovy_snapshot_version.outputs.value }}
20+
groovyVersion: ${{ steps.groovy-version.outputs.value }}
1721
steps:
1822

1923
- name: Set up JDK
2024
uses: actions/setup-java@v4
2125
with:
2226
distribution: temurin
23-
java-version: 11
27+
java-version: 17
2428

2529
- name: Cache local Maven repository & Groovy
2630
uses: actions/cache@v4
@@ -29,91 +33,67 @@ jobs:
2933
~/groovy
3034
~/.m2/repository
3135
key: cache-local-groovy-maven-${{ github.sha }}
32-
33-
- name: Checkout project to fetch some versions it uses
34-
uses: actions/checkout@v4
35-
with:
36-
sparse-checkout-cone-mode: false
37-
sparse-checkout: |
38-
settings.gradle
39-
gradle/libs.versions.toml
40-
41-
- name: Get version of Gradle Enterprise plugin
42-
id: gradle_enterprise_version
43-
run: |
44-
GE_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.enterprise\"\|'"'com.gradle.enterprise'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:])
45-
GE_USER_DATA_PLUGIN_VERSION=$(grep -m 1 'id\s*\(\"com.gradle.common-custom-user-data-gradle-plugin\"\|'"'com.gradle.common-custom-user-data-gradle-plugin'"'\)\s*version' settings.gradle | sed -E "s/.*version[[:space:]]*['\"]?([0-9]+\.[0-9]+(\.[0-9]+)?)['\"]?.*/\1/" | tr -d [:space:])
46-
echo "Project uses Gradle Enterprise Plugin version: $GE_PLUGIN_VERSION"
47-
echo "Project uses Gradle Common Custom User Data Plugin version: $GE_USER_DATA_PLUGIN_VERSION"
48-
echo "ge_plugin_version=$GE_PLUGIN_VERSION" >> $GITHUB_OUTPUT
49-
echo "ge_user_data_plugin_version=$GE_USER_DATA_PLUGIN_VERSION" >> $GITHUB_OUTPUT
50-
rm settings.gradle
51-
52-
- name: Select Groovy Branch to checkout
53-
id: groovy_branch
54-
run: |
55-
PROJECT_GROOVY_VERSION=$(grep -m 1 groovy gradle/libs.versions.toml | cut -d\= -f2 | tr -d "[:space:]'\"")
56-
MAJOR_VERSION=$(echo $PROJECT_GROOVY_VERSION | cut -d'.' -f1)
57-
MINOR_VERSION=$(echo $PROJECT_GROOVY_VERSION | cut -d'.' -f2)
58-
BRANCH="GROOVY_${MAJOR_VERSION}_${MINOR_VERSION}_X"
59-
echo "Project uses Groovy $PROJECT_GROOVY_VERSION"
60-
echo "value=$BRANCH" >> $GITHUB_OUTPUT
61-
rm -rf gradle
62-
63-
- name: Checkout Groovy Snapshot
64-
run: |
65-
BRANCH=${{ steps.groovy_branch.outputs.value }}
66-
echo "Checking out Groovy branch $BRANCH"
67-
cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b $BRANCH --single-branch
68-
69-
- name: Set Groovy Snapshot version for project build
70-
id: groovy_snapshot_version
36+
- name: Checkout Groovy 4_0_X (Grails 7 and later)
37+
run: cd .. && git clone --depth 1 https://github.com/apache/groovy.git -b GROOVY_4_0_X --single-branch
38+
- name: Set CI_GROOVY_VERSION for Grails
39+
id: groovy-version
7140
run: |
7241
cd ../groovy
73-
GROOVY_SNAPSHOT_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d "[:space:]")
74-
echo "value=$GROOVY_SNAPSHOT_VERSION" >> $GITHUB_OUTPUT
75-
76-
- name: Prepare Gradle Enterprise Set-up Configuration
77-
id: ge_conf
42+
echo "CI_GROOVY_VERSION=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_ENV
43+
echo "value=$(cat gradle.properties | grep groovyVersion | cut -d\= -f2 | tr -d '[:space:]')" >> $GITHUB_OUTPUT
44+
- name: Prepare Develocity Setup 1
45+
id: develocity_conf_1
7846
run: |
7947
echo "VALUE<<EOF" >> $GITHUB_OUTPUT
8048
echo "plugins { " >> $GITHUB_OUTPUT
81-
echo " id 'com.gradle.enterprise' version '${{ steps.gradle_enterprise_version.outputs.ge_plugin_version }}'" >> $GITHUB_OUTPUT
82-
echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '${{ steps.gradle_enterprise_version.outputs.ge_user_data_plugin_version }}'" >> $GITHUB_OUTPUT
49+
echo " id 'com.gradle.enterprise' version '3.15.1'" >> $GITHUB_OUTPUT
50+
echo " id 'com.gradle.common-custom-user-data-gradle-plugin' version '1.11.3'" >> $GITHUB_OUTPUT
8351
echo "}" >> $GITHUB_OUTPUT
8452
echo "" >> $GITHUB_OUTPUT
53+
echo "EOF" >> $GITHUB_OUTPUT
54+
- name: Prepare Develocity Setup 2
55+
id: develocity_conf_2
56+
run: |
57+
echo "VALUE<<EOF" >> $GITHUB_OUTPUT
8558
echo "gradleEnterprise {" >> $GITHUB_OUTPUT
8659
echo " server = 'https://ge.grails.org'" >> $GITHUB_OUTPUT
8760
echo " buildScan {" >> $GITHUB_OUTPUT
8861
echo " publishAlways()" >> $GITHUB_OUTPUT
8962
echo " publishIfAuthenticated()" >> $GITHUB_OUTPUT
90-
echo " uploadInBackground = false" >> $GITHUB_OUTPUT
63+
echo " uploadInBackground = System.getenv('CI') == null" >> $GITHUB_OUTPUT
9164
echo " capture {" >> $GITHUB_OUTPUT
9265
echo " taskInputFiles = true" >> $GITHUB_OUTPUT
9366
echo " }" >> $GITHUB_OUTPUT
9467
echo " }" >> $GITHUB_OUTPUT
9568
echo "}" >> $GITHUB_OUTPUT
9669
echo "" >> $GITHUB_OUTPUT
9770
echo "buildCache {" >> $GITHUB_OUTPUT
98-
echo " local { enabled = false }" >> $GITHUB_OUTPUT
99-
echo " remote(gradleEnterprise.buildCache) {" >> $GITHUB_OUTPUT
100-
echo " push = true" >> $GITHUB_OUTPUT
71+
echo " local { enabled = System.getenv('CI') != 'true' }" >> $GITHUB_OUTPUT
72+
echo " remote(HttpBuildCache) {" >> $GITHUB_OUTPUT
73+
echo " push = System.getenv('CI') == 'true'" >> $GITHUB_OUTPUT
10174
echo " enabled = true" >> $GITHUB_OUTPUT
75+
echo " url = 'https://ge.grails.org/cache/'" >> $GITHUB_OUTPUT
76+
echo " credentials {" >> $GITHUB_OUTPUT
77+
echo " username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')" >> $GITHUB_OUTPUT
78+
echo " password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')" >> $GITHUB_OUTPUT
79+
echo " }" >> $GITHUB_OUTPUT
10280
echo " }" >> $GITHUB_OUTPUT
10381
echo "}" >> $GITHUB_OUTPUT
10482
echo "" >> $GITHUB_OUTPUT
10583
echo "EOF" >> $GITHUB_OUTPUT
106-
107-
- name: Gradle Enterprise Set-up
84+
- name: Develocity Set-up
10885
run: |
10986
cd ../groovy
110-
# Delete exiting plugins and build-scan from settings.gradle file
111-
sed -i '21,31d' settings.gradle
112-
# Add Gradle Enterprise set-up related configuration after line no 20 in settings.gradle
113-
echo "${{ steps.ge_conf.outputs.value }}" | sed -i -e "20r /dev/stdin" settings.gradle
114-
115-
- name: Build and install Groovy (no docs)
116-
uses: gradle/actions/setup-gradle@v3
87+
# Delete existing plugins from settings.gradle file
88+
sed -i '32,37d' settings.gradle
89+
# Add Gradle Enterprise set-up related configuration after line no 31 in settings.gradle
90+
echo "${{ steps.develocity_conf_1.outputs.value }}" | sed -i -e "31r /dev/stdin" settings.gradle
91+
# Delete existing buildCache configuration from gradle/build-scans.gradle file
92+
sed -i '23,46d' gradle/build-scans.gradle
93+
# Add Gradle Enterprise set-up related configuration after line no 22 in gradle/build-scans.gradle
94+
echo "${{ steps.develocity_conf_2.outputs.value }}" | sed -i -e "22r /dev/stdin" gradle/build-scans.gradle
95+
- name: Build and install groovy (no docs)
96+
uses: gradle/gradle-build-action@v3
11797
env:
11898
GRADLE_SCANS_ACCEPT: yes
11999
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
@@ -132,6 +112,8 @@ jobs:
132112
133113
build_project:
134114
needs: [build_groovy]
115+
strategy:
116+
fail-fast: true
135117
runs-on: ubuntu-latest
136118
steps:
137119

@@ -141,7 +123,7 @@ jobs:
141123
uses: actions/setup-java@v4
142124
with:
143125
distribution: temurin
144-
java-version: 11
126+
java-version: 17
145127

146128
- name: Cache local Maven repository & Groovy
147129
uses: actions/cache@v4
@@ -150,14 +132,13 @@ jobs:
150132
~/groovy
151133
~/.m2/repository
152134
key: cache-local-groovy-maven-${{ github.sha }}
153-
154-
- name: Build Project
155-
id: build_grails_project
156-
uses: gradle/actions/setup-gradle@v3
135+
- name: Set CI_GROOVY_VERSION for Grails
136+
run: |
137+
echo "CI_GROOVY_VERSION=${{needs.build_groovy.outputs.groovyVersion}}" >> $GITHUB_ENV
138+
- name: Build GORM
139+
id: build_gorm
140+
uses: gradle/gradle-build-action@v3
157141
env:
158-
GROOVY_VERSION: ${{ needs.build_groovy.outputs.groovySnapshotVersion }}
159-
CI_GROOVY_VERSION: ${{ needs.build_groovy.outputs.groovySnapshotVersion }}
160-
ORG_GRADLE_PROJECT_groovyVersion: ${{ needs.build_groovy.outputs.groovySnapshotVersion }}
161142
GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
162143
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
163144
GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}

.github/workflows/release.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@ name: Release
22
on:
33
release:
44
types: [published]
5-
65
jobs:
76
release:
87
runs-on: ubuntu-latest
9-
108
env:
11-
GIT_USER_NAME: puneetbehl
12-
GIT_USER_EMAIL: [email protected]
13-
9+
GIT_USER_NAME: 'grails-build'
10+
GIT_USER_EMAIL: '[email protected]'
1411
steps:
1512
- uses: actions/checkout@v4
1613
- uses: gradle/wrapper-validation-action@v2
1714
- uses: actions/setup-java@v4
18-
with: { distribution: temurin, java-version: 11 }
15+
with:
16+
distribution: temurin
17+
java-version: 17
1918

2019
- name: Set the current release version
2120
id: release_version
@@ -63,8 +62,8 @@ jobs:
6362
FOLDER: docs/build/docs
6463
VERSION: ${{ steps.release_version.outputs.release_version }}
6564
DOC_FOLDER: gh-pages
66-
COMMIT_EMAIL: [email protected]
67-
COMMIT_NAME: Puneet Behl
65+
COMMIT_EMAIL: '[email protected]'
66+
COMMIT_NAME: 'grails-build'
6867

6968
- name: Run post-release
7069
if: steps.publish_to_sonatype.outcome == 'success'

0 commit comments

Comments
 (0)