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