Compare commits

...

1 Commits
main ... v4.8.0

Author SHA1 Message Date
suisrc
d5ddf8cf5e add custom jdk url 2025-06-26 09:05:01 +08:00
2 changed files with 31 additions and 4 deletions

17
dist/setup/index.js vendored
View File

@ -128794,8 +128794,21 @@ class JavaBase {
else { else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
try { try {
const javaRelease = yield this.findPackageForDownload(this.version); const javaRelease = { version: this.version };
core.info(`Resolved latest version as ${javaRelease.version}`); const jdkUrl = core.getInput('jdk-url');
if (jdkUrl) {
if (!this.version) {
throw new Error('You must specify a version when using a custom JDK URL.');
}
core.info(`Using custom JDK URL: ${jdkUrl}`);
javaRelease.url = jdkUrl;
}
else {
const jdkPkg = yield this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
javaRelease.version = jdkPkg.version;
javaRelease.url = jdkPkg.url;
}
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) { if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`); core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} }

View File

@ -52,8 +52,22 @@ export abstract class JavaBase {
} else { } else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
try { try {
const javaRelease = await this.findPackageForDownload(this.version); const javaRelease = { version: this.version } as JavaDownloadRelease;
core.info(`Resolved latest version as ${javaRelease.version}`); const jdkUrl = core.getInput('jdk-url');
if (jdkUrl) {
if (!this.version) {
throw new Error(
'You must specify a version when using a custom JDK URL.'
);
}
core.info(`Using custom JDK URL: ${jdkUrl}`);
javaRelease.url = jdkUrl;
} else {
const jdkPkg = await this.findPackageForDownload(this.version)
core.info(`Resolved latest version as ${javaRelease.version}`);
javaRelease.version = jdkPkg.version;
javaRelease.url = jdkPkg.url;
}
if (foundJava?.version === javaRelease.version) { if (foundJava?.version === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`); core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else { } else {