Ensure minimum Gradle version for cache-cleanup (#364)

Instead of always installing and using the latest Gradle version for
cache cleanup, we now require at least Gradle 8.9.

This avoids downloading and installing Gradle if the version on PATH is
sufficient to perform cache cleanup.
This commit is contained in:
Daz DeBoer
2024-08-31 11:11:24 -06:00
committed by GitHub
parent 9291ac6ca5
commit 7e0f050645
5 changed files with 180 additions and 24 deletions

View File

@@ -55,11 +55,12 @@ export class CacheCleaner {
)
fs.writeFileSync(path.resolve(cleanupProjectDir, 'build.gradle'), 'task("noop") {}')
const executable = await provisioner.provisionGradle('current')
// Gradle >= 8.9 required for cache cleanup
const executable = await provisioner.provisionGradleAtLeast('8.9')
await core.group('Executing Gradle to clean up caches', async () => {
core.info(`Cleaning up caches last used before ${cleanTimestamp}`)
await this.executeCleanupBuild(executable!, cleanupProjectDir)
await this.executeCleanupBuild(executable, cleanupProjectDir)
})
}