Skip to content

Commit

Permalink
Check for new GraalVM versions in the update scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
keeganwitt committed Aug 15, 2023
1 parent e24445c commit 82e6b16
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
16 changes: 14 additions & 2 deletions update.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
$gradleVersion = $((Invoke-WebRequest https://services.gradle.org/versions/current | ConvertFrom-Json).version)
$sha = $(Invoke-RestMethod -Uri https://downloads.gradle.org/distributions/gradle-${gradleVersion}-bin.zip.sha256)
$gradleVersion = $((Invoke-WebRequest "https://services.gradle.org/versions/current" | ConvertFrom-Json).version)
$sha = $(Invoke-RestMethod -Uri "https://downloads.gradle.org/distributions/gradle-${gradleVersion}-bin.zip.sha256")

$latestGraal17 = $(((Invoke-WebRequest "https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=4&page=1" | ConvertFrom-Json).tag_name | Select-String -Pattern "jdk-17").ToString().Replace("jdk-", ""))
$latestGraal20 = $(((Invoke-WebRequest "https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=4&page=1" | ConvertFrom-Json).tag_name | Select-String -Pattern "jdk-20").ToString().Replace("jdk-", ""))

dir -Recurse -Filter Dockerfile | ForEach-Object {
(Get-Content -Path $_.FullName) -replace "ENV GRADLE_VERSION .+$", "ENV GRADLE_VERSION ${gradleVersion}" | Set-Content $_.FullName
(Get-Content -Path $_.FullName) -replace "GRADLE_DOWNLOAD_SHA256=.+$", "GRADLE_DOWNLOAD_SHA256=${sha}" | Set-Content $_.FullName
if ($((Get-Item $_.FullName).Directory.Name) -match "jdk17.+graal")
{
(Get-Content -Path $_.FullName) -replace "JDK_VERSION=[^ ]+", "JDK_VERSION=${latestGraal17}" | Set-Content $_.FullName
}
if ($((Get-Item $_.FullName).Directory.Name) -match "jdk20.+graal")
{
(Get-Content -Path $_.FullName) -replace "JDK_VERSION=[^ ]+", "JDK_VERSION=${latestGraal20}" | Set-Content $_.FullName
}
}

(Get-Content -Path .github/workflows/ci.yaml) -replace "expectedGradleVersion: .+", "expectedGradleVersion: `"${gradleVersion}`"" | Set-Content .github/workflows/ci.yaml
6 changes: 6 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,9 @@ sha=$(curl --fail --show-error --silent --location "https://downloads.gradle.org
sed --regexp-extended --in-place "s/ENV GRADLE_VERSION .+$/ENV GRADLE_VERSION ${gradleVersion}/" ./*/Dockerfile
sed --regexp-extended --in-place "s/GRADLE_DOWNLOAD_SHA256=.+$/GRADLE_DOWNLOAD_SHA256=${sha}/" ./*/Dockerfile
sed --regexp-extended --in-place "s/expectedGradleVersion: .+$/expectedGradleVersion: \"${gradleVersion}\"/" .github/workflows/ci.yaml

latestGraal17=$(curl --silent --location 'https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=2&page=1' | jq -r 'map(select(.tag_name | contains("jdk-17"))) | .[0].tag_name | sub("jdk-"; "")')
sed --regexp-extended --in-place "s/JDK_VERSION=[^ ]+/JDK_VERSION=${latestGraal17}/" ./jdk17*graal/Dockerfile

latestGraal20=$( curl --silent --location 'https://api.github.com/repos/graalvm/graalvm-ce-builds/releases?per_page=2&page=1' | jq -r 'map(select(.tag_name | contains("jdk-20"))) | .[0].tag_name | sub("jdk-"; "")')
sed --regexp-extended --in-place "s/JDK_VERSION=[^ ]+/JDK_VERSION=${latestGraal20}/" ./jdk20*graal/Dockerfile

0 comments on commit 82e6b16

Please sign in to comment.