From 87c3a8e332e8a037000a19b5639435d38d57502b Mon Sep 17 00:00:00 2001 From: Keegan Witt Date: Sat, 16 Mar 2024 21:46:29 -0400 Subject: [PATCH] Update scripts to determine new version of Groovy --- update.ps1 | 4 +++- update.sh | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/update.ps1 b/update.ps1 index 4f3cbd4..9be503d 100644 --- a/update.ps1 +++ b/update.ps1 @@ -1,4 +1,6 @@ -$groovyVersion = $($args[0]) +$groovyVersion = $(((Invoke-WebRequest "https://api.github.com/repos/apache/groovy/tags" | ConvertFrom-Json).name | Select-String -Pattern "GROOVY_4" | Select-Object -First 1).ToString().replace("GROOVY_", "").replace("_", ".")) + +Write-Host "Updating to Groovy $groovyVersion" dir -Recurse -Filter Dockerfile | ForEach-Object { (Get-Content -Path $_.FullName) -replace "ENV GROOVY_VERSION .+", "ENV GROOVY_VERSION ${groovyVersion}" | Set-Content $_.FullName diff --git a/update.sh b/update.sh index ffc7cc9..669c2c2 100644 --- a/update.sh +++ b/update.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash set -o errexit -o nounset -o pipefail -groovyVersion=${1} +groovyVersion=$(curl -s 'https://api.github.com/repos/apache/groovy/tags' | grep -Eo 'GROOVY_4.[0-9]{1,2}.[0-9]{1,2}' | head -n 1 | sed -e 's/GROOVY_//' -e 's/_/./g') +echo "Updating to Groovy $groovyVersion" sed --regexp-extended --in-place "s/ENV GROOVY_VERSION .+/ENV GROOVY_VERSION ${groovyVersion}/" ./*/Dockerfile sed --regexp-extended --in-place "s/expectedGroovyVersion: .+$/expectedGroovyVersion: ${groovyVersion}/" .github/workflows/ci.yaml