From 525ab50527f1cdec3045863dbfe60aa965b6131f Mon Sep 17 00:00:00 2001
From: Guillermo Calvo <guillermo@guillermo.dev>
Date: Sun, 17 Mar 2024 22:47:29 +0100
Subject: [PATCH] Migrate to Develocity build cache connector (#180)

Co-authored-by: Puneet Behl <behlp@unityfoundation.io>
---
 .github/workflows/gradle.yml |  2 --
 settings.gradle              | 10 +++-------
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index b7d04b10..0284a069 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -25,8 +25,6 @@ jobs:
         uses: gradle/gradle-build-action@v3
         env:
           GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_ACCESS_KEY }}
-          GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER }}
-          GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY: ${{ secrets.GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY }}
         with:
           arguments: build -Dgeb.env=chromeHeadless
       - name: Publish to repo.grails.org
diff --git a/settings.gradle b/settings.gradle
index 0840e521..afc1d883 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -17,14 +17,10 @@ gradleEnterprise {
 
 buildCache {
     local { enabled = System.getenv('CI') != 'true' }
-    remote(HttpBuildCache) {
-        push = System.getenv('CI') == 'true'
+    remote(gradleEnterprise.buildCache) {
+        def isAuthenticated = System.getenv('GRADLE_ENTERPRISE_ACCESS_KEY')
+        push = System.getenv('CI') == 'true' && isAuthenticated
         enabled = true
-        url = 'https://ge.grails.org/cache/'
-        credentials {
-            username = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_USER')
-            password = System.getenv('GRADLE_ENTERPRISE_BUILD_CACHE_NODE_KEY')
-        }
     }}
 
 rootProject.name = 'cache'
\ No newline at end of file