Temporarily use 22.3.1 for latest builds.

This is a temporary fix while we are rolling out the new GraalVM for JDK17/20 release.
This commit is contained in:
Fabio Niephaus
2023-06-13 19:17:04 +02:00
parent babc303d7e
commit b11d36630f
6 changed files with 67 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import {getLatestRelease, toSemVer} from '../utils'
import {getTaggedRelease, toSemVer} from '../utils'
import {lt, major, minor, valid} from 'semver'
import {findGraalVMVersion} from '../graalvm'
import {GRAALVM_RELEASES_REPO} from '../constants'
@@ -15,7 +15,10 @@ export async function checkForUpdates(
return
}
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
const latestRelease = await getTaggedRelease(
GRAALVM_RELEASES_REPO,
'vm-22.3.1'
)
const latestGraalVMVersion = findGraalVMVersion(latestRelease)
const selectedVersion = toSemVer(graalVMVersion)
const latestVersion = toSemVer(latestGraalVMVersion)

View File

@@ -2,7 +2,8 @@ import * as c from './constants'
import {
downloadAndExtractJDK,
downloadExtractAndCacheJDK,
getLatestRelease
getLatestRelease,
getTaggedRelease
} from './utils'
import {downloadGraalVMEE} from './gds'
import {downloadTool} from '@actions/tool-cache'
@@ -15,10 +16,14 @@ export async function setUpGraalVMLatest(
gdsToken: string,
javaVersion: string
): Promise<string> {
const lockedVersion = '22.3.1'
if (gdsToken.length > 0) {
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion)
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion)
}
const latestRelease = await getLatestRelease(c.GRAALVM_RELEASES_REPO)
const latestRelease = await getTaggedRelease(
c.GRAALVM_RELEASES_REPO,
GRAALVM_TAG_PREFIX + lockedVersion
)
const version = findGraalVMVersion(latestRelease)
return setUpGraalVMRelease(gdsToken, version, javaVersion)
}

View File

@@ -47,6 +47,22 @@ export async function getLatestRelease(
).data
}
export async function getTaggedRelease(
repo: string,
tag: string
): Promise<c.LatestReleaseResponse['data']> {
const githubToken = getGitHubToken()
const options = githubToken.length > 0 ? {auth: githubToken} : {}
const octokit = new GitHubDotCom(options)
return (
await octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
owner: c.GRAALVM_GH_USER,
repo,
tag
})
).data
}
export async function downloadAndExtractJDK(
downloadUrl: string
): Promise<string> {