diff --git a/dist/index.js b/dist/index.js
index 966326536..fc3831b15 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -4680,7 +4680,10 @@ function getJava(version, arch, jdkFile, javaPackage) {
allowRetries: true,
maxRetries: 3
});
- const url = 'https://static.azul.com/zulu/bin/';
+ const ZULU_BASE_URL = 'https://cdn.zulu.org/zulu';
+ const url = version.includes('-ea')
+ ? `${ZULU_BASE_URL}/ea/`
+ : `${ZULU_BASE_URL}/releases/`;
const response = yield http.get(url);
const statusCode = response.message.statusCode || 0;
if (statusCode < 200 || statusCode > 299) {
@@ -4696,7 +4699,7 @@ function getJava(version, arch, jdkFile, javaPackage) {
}
const contents = yield response.readBody();
const refs = contents.match(//gi) || [];
- const downloadInfo = getDownloadInfo(refs, version, javaPackage);
+ const downloadInfo = getDownloadInfo(refs, version, javaPackage, url);
jdkFile = yield tc.downloadTool(downloadInfo.url);
version = downloadInfo.version;
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
@@ -4804,7 +4807,7 @@ function unzipJavaDownload(repoRoot, fileEnding, destinationFolder, extension) {
}
});
}
-function getDownloadInfo(refs, version, javaPackage) {
+function getDownloadInfo(refs, version, javaPackage, baseUrl) {
version = normalizeVersion(version);
let extension = '';
if (IS_WINDOWS) {
@@ -4845,15 +4848,14 @@ function getDownloadInfo(refs, version, javaPackage) {
// If we haven't returned, means we're looking at the correct platform
let versions = ref.match(pkgRegexp) || [];
if (versions.length > 1) {
- throw new Error(`Invalid ref received from https://static.azul.com/zulu/bin/: ${ref}`);
+ throw new Error(`Invalid ref received from ${baseUrl}: ${ref}`);
}
if (versions.length == 0) {
return;
}
const refVersion = versions[0].slice(pkgTypeLength, versions[0].length - 1);
if (semver.satisfies(refVersion, version)) {
- versionMap.set(refVersion, 'https://static.azul.com/zulu/bin/' +
- ref.slice(''.length));
+ versionMap.set(refVersion, `${baseUrl}` + ref.slice(''.length));
}
});
// Choose the most recent satisfying version
@@ -4868,7 +4870,7 @@ function getDownloadInfo(refs, version, javaPackage) {
}
}
if (curUrl == '') {
- throw new Error(`No valid download found for version ${version} and package ${javaPackage}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`);
+ throw new Error(`No valid download found for version ${version} and package ${javaPackage}. Check ${baseUrl} for a list of valid versions or download your own jdk file and add the jdkFile argument`);
}
return { version: curVersion, url: curUrl };
}
diff --git a/src/installer.ts b/src/installer.ts
index cce8fa3d3..adb4b13cf 100644
--- a/src/installer.ts
+++ b/src/installer.ts
@@ -44,7 +44,10 @@ export async function getJava(
allowRetries: true,
maxRetries: 3
});
- const url = 'https://static.azul.com/zulu/bin/';
+ const ZULU_BASE_URL = 'https://cdn.zulu.org/zulu';
+ const url = version.includes('-ea')
+ ? `${ZULU_BASE_URL}/ea/`
+ : `${ZULU_BASE_URL}/releases/`;
const response = await http.get(url);
const statusCode = response.message.statusCode || 0;
if (statusCode < 200 || statusCode > 299) {
@@ -60,7 +63,7 @@ export async function getJava(
const contents = await response.readBody();
const refs = contents.match(//gi) || [];
- const downloadInfo = getDownloadInfo(refs, version, javaPackage);
+ const downloadInfo = getDownloadInfo(refs, version, javaPackage, url);
jdkFile = await tc.downloadTool(downloadInfo.url);
version = downloadInfo.version;
compressedFileExtension = IS_WINDOWS ? '.zip' : '.tar.gz';
@@ -188,7 +191,8 @@ async function unzipJavaDownload(
function getDownloadInfo(
refs: string[],
version: string,
- javaPackage: string
+ javaPackage: string,
+ baseUrl: string
): {version: string; url: string} {
version = normalizeVersion(version);
let extension = '';
@@ -231,9 +235,7 @@ function getDownloadInfo(
// If we haven't returned, means we're looking at the correct platform
let versions = ref.match(pkgRegexp) || [];
if (versions.length > 1) {
- throw new Error(
- `Invalid ref received from https://static.azul.com/zulu/bin/: ${ref}`
- );
+ throw new Error(`Invalid ref received from ${baseUrl}: ${ref}`);
}
if (versions.length == 0) {
return;
@@ -243,8 +245,7 @@ function getDownloadInfo(
if (semver.satisfies(refVersion, version)) {
versionMap.set(
refVersion,
- 'https://static.azul.com/zulu/bin/' +
- ref.slice(''.length)
+ `${baseUrl}` + ref.slice(''.length)
);
}
});
@@ -263,7 +264,7 @@ function getDownloadInfo(
if (curUrl == '') {
throw new Error(
- `No valid download found for version ${version} and package ${javaPackage}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`
+ `No valid download found for version ${version} and package ${javaPackage}. Check ${baseUrl} for a list of valid versions or download your own jdk file and add the jdkFile argument`
);
}