diff --git a/lib/installer.js b/lib/installer.js index 0797a8fb..89f242bb 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -48,8 +48,7 @@ function getJava(version, arch, jdkFile) { } else { if (!jdkFile) { - const downloadUrl = yield getDownloadUrl(version); - jdkFile = yield tc.downloadTool(downloadUrl); + jdkFile = yield downloadJava(version); } core.debug('Retrieving Jdk from local path'); const compressedFileExtension = getFileEnding(jdkFile); @@ -145,7 +144,7 @@ function unzipJavaDownload(repoRoot, fileEnding, destinationFolder) { } }); } -function getDownloadUrl(version) { +function downloadJava(version) { return __awaiter(this, void 0, void 0, function* () { let filterString = ''; if (IS_WINDOWS) { @@ -170,7 +169,8 @@ function getDownloadUrl(version) { if (refs.length == 0) { throw new Error(`No valid download found for version ${version}. Check https://static.azul.com/zulu/bin/ for a list of valid versions or download your own jdk file and add the jdkFile argument`); } - const downloadLocation = refs[0].slice(''.length); - return `https://static.azul.com/zulu/bin/${downloadLocation}`; + const fileName = refs[0].slice(''.length); + const dest = yield tc.downloadTool(`https://static.azul.com/zulu/bin/${fileName}`); + return path.join(dest, fileName); }); } diff --git a/src/installer.ts b/src/installer.ts index 0ad8aa21..8a43e616 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -36,8 +36,7 @@ export async function getJava( core.debug(`Tool found in cache ${toolPath}`); } else { if (!jdkFile) { - const downloadUrl: string = await getDownloadUrl(version); - jdkFile = await tc.downloadTool(downloadUrl); + jdkFile = await downloadJava(version); } core.debug('Retrieving Jdk from local path'); const compressedFileExtension = getFileEnding(jdkFile); @@ -144,7 +143,7 @@ async function unzipJavaDownload( } } -async function getDownloadUrl(version: string) { +async function downloadJava(version: string): Promise { let filterString = ''; if (IS_WINDOWS) { filterString = `jdk${version}-win_x64.zip`; @@ -172,9 +171,12 @@ async function getDownloadUrl(version: string) { ); } - const downloadLocation = refs[0].slice( + const fileName = refs[0].slice( ''.length ); - return `https://static.azul.com/zulu/bin/${downloadLocation}`; + const dest = await tc.downloadTool( + `https://static.azul.com/zulu/bin/${fileName}` + ); + return path.join(dest, fileName); }