mirror of
https://github.com/actions/setup-java.git
synced 2025-07-04 10:40:54 +00:00
Compare commits
No commits in common. "main" and "v4" have entirely different histories.
@ -2,8 +2,7 @@ name: 'Publish Immutable Action Version'
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
workflow_dispatch:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -41,7 +41,9 @@ describe('getAvailableVersions', () => {
|
||||
expect(availableVersions).not.toBeNull();
|
||||
|
||||
const length =
|
||||
os.platform() === 'win32' ? manifestData.length : manifestData.length + 2;
|
||||
os.platform() === 'win32'
|
||||
? manifestData.length - 1
|
||||
: manifestData.length + 1;
|
||||
expect(availableVersions.length).toBe(length);
|
||||
}, 10_000);
|
||||
});
|
||||
|
36
dist/setup/index.js
vendored
36
dist/setup/index.js
vendored
@ -128793,7 +128793,6 @@ class JavaBase {
|
||||
}
|
||||
else {
|
||||
core.info('Trying to resolve the latest version from remote');
|
||||
try {
|
||||
const javaRelease = yield this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) {
|
||||
@ -128805,28 +128804,6 @@ class JavaBase {
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof tc.HTTPError) {
|
||||
if (error.httpStatusCode === 403) {
|
||||
core.error('HTTP 403: Permission denied or access restricted.');
|
||||
}
|
||||
else if (error.httpStatusCode === 429) {
|
||||
core.warning('HTTP 429: Rate limit exceeded. Please retry later.');
|
||||
}
|
||||
else {
|
||||
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
|
||||
}
|
||||
}
|
||||
else {
|
||||
const message = error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(`Java setup failed due to network issue or timeout: ${message}`);
|
||||
}
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
|
||||
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
|
||||
@ -129695,12 +129672,7 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
||||
// url is identical except page_index so print it once for debug
|
||||
core.debug(`Gathering available versions from '${rawUrl}'`);
|
||||
}
|
||||
const paginationPageResult = (yield this.http.getJson(rawUrl, requestHeaders)).result;
|
||||
if (!paginationPageResult || paginationPageResult.length === 0) {
|
||||
// break infinity loop because we have reached end of pagination
|
||||
break;
|
||||
}
|
||||
const paginationPage = paginationPageResult.filter(version => this.stable ? !version.prerelease : version.prerelease);
|
||||
const paginationPage = (yield this.http.getJson(rawUrl, requestHeaders)).result;
|
||||
if (!paginationPage || paginationPage.length === 0) {
|
||||
// break infinity loop because we have reached end of pagination
|
||||
break;
|
||||
@ -129708,11 +129680,9 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
||||
rawVersions.push(...paginationPage);
|
||||
page_index++;
|
||||
}
|
||||
if (this.stable) {
|
||||
// Add versions not available from the API but are downloadable
|
||||
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
|
||||
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag, prerelease: false })));
|
||||
}
|
||||
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag })));
|
||||
const versions0 = rawVersions.map((v) => __awaiter(this, void 0, void 0, function* () {
|
||||
var _a;
|
||||
// Release tags look like one of these:
|
||||
@ -129731,7 +129701,7 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
||||
.replace('-', '');
|
||||
const vsplit = vstring.split('b');
|
||||
let semver = vsplit[0];
|
||||
const build = vsplit[1];
|
||||
const build = +vsplit[1];
|
||||
// Normalize semver
|
||||
if (!semver.includes('.') && !semver.includes('_'))
|
||||
semver = `${semver}.0.0`;
|
||||
|
@ -51,7 +51,6 @@ export abstract class JavaBase {
|
||||
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
|
||||
} else {
|
||||
core.info('Trying to resolve the latest version from remote');
|
||||
try {
|
||||
const javaRelease = await this.findPackageForDownload(this.version);
|
||||
core.info(`Resolved latest version as ${javaRelease.version}`);
|
||||
if (foundJava?.version === javaRelease.version) {
|
||||
@ -61,27 +60,6 @@ export abstract class JavaBase {
|
||||
foundJava = await this.downloadTool(javaRelease);
|
||||
core.info(`Java ${foundJava.version} was downloaded`);
|
||||
}
|
||||
} catch (error: any) {
|
||||
if (error instanceof tc.HTTPError) {
|
||||
if (error.httpStatusCode === 403) {
|
||||
core.error('HTTP 403: Permission denied or access restricted.');
|
||||
} else if (error.httpStatusCode === 429) {
|
||||
core.warning('HTTP 429: Rate limit exceeded. Please retry later.');
|
||||
} else {
|
||||
core.error(`HTTP ${error.httpStatusCode}: ${error.message}`);
|
||||
}
|
||||
} else {
|
||||
const message =
|
||||
error instanceof Error ? error.message : JSON.stringify(error);
|
||||
core.error(
|
||||
`Java setup failed due to network issue or timeout: ${message}`
|
||||
);
|
||||
}
|
||||
if (error instanceof Error && error.stack) {
|
||||
core.debug(error.stack);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
// JDK folder may contain postfix "Contents/Home" on macOS
|
||||
|
@ -113,18 +113,9 @@ export class JetBrainsDistribution extends JavaBase {
|
||||
core.debug(`Gathering available versions from '${rawUrl}'`);
|
||||
}
|
||||
|
||||
const paginationPageResult = (
|
||||
const paginationPage = (
|
||||
await this.http.getJson<IJetBrainsRawVersion[]>(rawUrl, requestHeaders)
|
||||
).result;
|
||||
if (!paginationPageResult || paginationPageResult.length === 0) {
|
||||
// break infinity loop because we have reached end of pagination
|
||||
break;
|
||||
}
|
||||
|
||||
const paginationPage: IJetBrainsRawVersion[] =
|
||||
paginationPageResult.filter(version =>
|
||||
this.stable ? !version.prerelease : version.prerelease
|
||||
);
|
||||
if (!paginationPage || paginationPage.length === 0) {
|
||||
// break infinity loop because we have reached end of pagination
|
||||
break;
|
||||
@ -134,13 +125,9 @@ export class JetBrainsDistribution extends JavaBase {
|
||||
page_index++;
|
||||
}
|
||||
|
||||
if (this.stable) {
|
||||
// Add versions not available from the API but are downloadable
|
||||
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
|
||||
rawVersions.push(
|
||||
...hidden.map(tag => ({tag_name: tag, name: tag, prerelease: false}))
|
||||
);
|
||||
}
|
||||
rawVersions.push(...hidden.map(tag => ({tag_name: tag, name: tag})));
|
||||
|
||||
const versions0 = rawVersions.map(async v => {
|
||||
// Release tags look like one of these:
|
||||
@ -161,7 +148,7 @@ export class JetBrainsDistribution extends JavaBase {
|
||||
|
||||
const vsplit = vstring.split('b');
|
||||
let semver = vsplit[0];
|
||||
const build = vsplit[1];
|
||||
const build = +vsplit[1];
|
||||
|
||||
// Normalize semver
|
||||
if (!semver.includes('.') && !semver.includes('_'))
|
||||
|
@ -3,12 +3,11 @@
|
||||
export interface IJetBrainsRawVersion {
|
||||
tag_name: string;
|
||||
name: string;
|
||||
prerelease: boolean;
|
||||
}
|
||||
|
||||
export interface IJetBrainsVersion {
|
||||
tag_name: string;
|
||||
semver: string;
|
||||
build: string;
|
||||
build: number;
|
||||
url: string;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user