Skip to content

Commit b11d366

Browse files
committed
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.
1 parent babc303 commit b11d366

File tree

6 files changed

+67
-13
lines changed

6 files changed

+67
-13
lines changed

__tests__/graalvm.test.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as path from 'path'
22
import * as graalvm from '../src/graalvm'
33
import {expect, test} from '@jest/globals'
4-
import {getLatestRelease} from '../src/utils'
4+
import {getTaggedRelease} from '../src/utils'
55
import {findGraalVMVersion, findHighestJavaVersion} from '../src/graalvm'
66
import {GRAALVM_RELEASES_REPO} from '../src/constants'
77

@@ -31,7 +31,10 @@ test('request invalid version/javaVersion', async () => {
3131
})
3232

3333
test('find version/javaVersion', async () => {
34-
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
34+
const latestRelease = await getTaggedRelease(
35+
GRAALVM_RELEASES_REPO,
36+
'vm-22.3.1'
37+
)
3538
const latestVersion = findGraalVMVersion(latestRelease)
3639
expect(latestVersion).not.toBe('')
3740
const latestJavaVersion = findHighestJavaVersion(latestRelease, latestVersion)
@@ -43,7 +46,7 @@ test('find version/javaVersion', async () => {
4346
findGraalVMVersion(invalidRelease)
4447
} catch (err) {
4548
if (!(err instanceof Error)) {
46-
fail(`Unexpected non-Erro: ${err}`)
49+
fail(`Unexpected non-Error: ${err}`)
4750
}
4851
error = err
4952
}

dist/cleanup/index.js

Lines changed: 14 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/main/index.js

Lines changed: 18 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/check-for-updates.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as core from '@actions/core'
2-
import {getLatestRelease, toSemVer} from '../utils'
2+
import {getTaggedRelease, toSemVer} from '../utils'
33
import {lt, major, minor, valid} from 'semver'
44
import {findGraalVMVersion} from '../graalvm'
55
import {GRAALVM_RELEASES_REPO} from '../constants'
@@ -15,7 +15,10 @@ export async function checkForUpdates(
1515
return
1616
}
1717

18-
const latestRelease = await getLatestRelease(GRAALVM_RELEASES_REPO)
18+
const latestRelease = await getTaggedRelease(
19+
GRAALVM_RELEASES_REPO,
20+
'vm-22.3.1'
21+
)
1922
const latestGraalVMVersion = findGraalVMVersion(latestRelease)
2023
const selectedVersion = toSemVer(graalVMVersion)
2124
const latestVersion = toSemVer(latestGraalVMVersion)

src/graalvm.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import * as c from './constants'
22
import {
33
downloadAndExtractJDK,
44
downloadExtractAndCacheJDK,
5-
getLatestRelease
5+
getLatestRelease,
6+
getTaggedRelease
67
} from './utils'
78
import {downloadGraalVMEE} from './gds'
89
import {downloadTool} from '@actions/tool-cache'
@@ -15,10 +16,14 @@ export async function setUpGraalVMLatest(
1516
gdsToken: string,
1617
javaVersion: string
1718
): Promise<string> {
19+
const lockedVersion = '22.3.1'
1820
if (gdsToken.length > 0) {
19-
return setUpGraalVMRelease(gdsToken, c.VERSION_LATEST, javaVersion)
21+
return setUpGraalVMRelease(gdsToken, lockedVersion, javaVersion)
2022
}
21-
const latestRelease = await getLatestRelease(c.GRAALVM_RELEASES_REPO)
23+
const latestRelease = await getTaggedRelease(
24+
c.GRAALVM_RELEASES_REPO,
25+
GRAALVM_TAG_PREFIX + lockedVersion
26+
)
2227
const version = findGraalVMVersion(latestRelease)
2328
return setUpGraalVMRelease(gdsToken, version, javaVersion)
2429
}

src/utils.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,22 @@ export async function getLatestRelease(
4747
).data
4848
}
4949

50+
export async function getTaggedRelease(
51+
repo: string,
52+
tag: string
53+
): Promise<c.LatestReleaseResponse['data']> {
54+
const githubToken = getGitHubToken()
55+
const options = githubToken.length > 0 ? {auth: githubToken} : {}
56+
const octokit = new GitHubDotCom(options)
57+
return (
58+
await octokit.request('GET /repos/{owner}/{repo}/releases/tags/{tag}', {
59+
owner: c.GRAALVM_GH_USER,
60+
repo,
61+
tag
62+
})
63+
).data
64+
}
65+
5066
export async function downloadAndExtractJDK(
5167
downloadUrl: string
5268
): Promise<string> {

0 commit comments

Comments
 (0)