Skip to content

Commit

Permalink
Update scripts to determine new version of Groovy
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganwitt committed Mar 17, 2024
1 parent b97b7a7 commit 87c3a8e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion update.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 2 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 87c3a8e

Please sign in to comment.