mirror of
https://github.com/actions/setup-java.git
synced 2026-07-10 07:16:19 +00:00
Compare commits
3 Commits
4e56c31b28
...
bd0d2b8f65
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bd0d2b8f65 | ||
|
|
847079da47 | ||
|
|
393543671a |
@ -25,21 +25,10 @@ describe('getAvailableVersions', () => {
|
|||||||
|
|
||||||
it('load available versions', async () => {
|
it('load available versions', async () => {
|
||||||
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
spyHttpClient = jest.spyOn(HttpClient.prototype, 'getJson');
|
||||||
spyHttpClient
|
spyHttpClient.mockReturnValueOnce({
|
||||||
.mockReturnValueOnce({
|
|
||||||
statusCode: 200,
|
statusCode: 200,
|
||||||
headers: {},
|
headers: {},
|
||||||
result: manifestData as any
|
result: manifestData as any
|
||||||
})
|
|
||||||
.mockReturnValueOnce({
|
|
||||||
statusCode: 200,
|
|
||||||
headers: {},
|
|
||||||
result: manifestData as any
|
|
||||||
})
|
|
||||||
.mockReturnValueOnce({
|
|
||||||
statusCode: 200,
|
|
||||||
headers: {},
|
|
||||||
result: []
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const distribution = new JetBrainsDistribution({
|
const distribution = new JetBrainsDistribution({
|
||||||
@ -53,8 +42,8 @@ describe('getAvailableVersions', () => {
|
|||||||
|
|
||||||
const length =
|
const length =
|
||||||
os.platform() === 'win32'
|
os.platform() === 'win32'
|
||||||
? manifestData.length * 2 - 4
|
? manifestData.length - 2
|
||||||
: manifestData.length * 2;
|
: manifestData.length + 1;
|
||||||
expect(availableVersions.length).toBe(length);
|
expect(availableVersions.length).toBe(length);
|
||||||
}, 10_000);
|
}, 10_000);
|
||||||
});
|
});
|
||||||
|
|||||||
8
dist/setup/index.js
vendored
8
dist/setup/index.js
vendored
@ -124592,11 +124592,12 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||||||
// GitHub API doesn't provide way to retrieve the count of pages to iterate so infinity loop
|
// GitHub API doesn't provide way to retrieve the count of pages to iterate so infinity loop
|
||||||
let page_index = 1;
|
let page_index = 1;
|
||||||
const rawVersions = [];
|
const rawVersions = [];
|
||||||
|
const bearerToken = process.env.GITHUB_TOKEN;
|
||||||
while (true) {
|
while (true) {
|
||||||
const requestArguments = `per_page=100&page=${page_index}`;
|
const requestArguments = `per_page=100&page=${page_index}`;
|
||||||
const requestHeaders = {};
|
const requestHeaders = {};
|
||||||
if (process.env.GITHUB_TOKEN) {
|
if (bearerToken) {
|
||||||
requestHeaders['Authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
|
requestHeaders['Authorization'] = `Bearer ${bearerToken}`;
|
||||||
}
|
}
|
||||||
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
||||||
if (core.isDebug() && page_index === 1) {
|
if (core.isDebug() && page_index === 1) {
|
||||||
@ -124611,6 +124612,9 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
|
|||||||
rawVersions.push(...paginationPage);
|
rawVersions.push(...paginationPage);
|
||||||
page_index++;
|
page_index++;
|
||||||
}
|
}
|
||||||
|
// 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 })));
|
||||||
const versions0 = rawVersions.map((v) => __awaiter(this, void 0, void 0, function* () {
|
const versions0 = rawVersions.map((v) => __awaiter(this, void 0, void 0, function* () {
|
||||||
var _a;
|
var _a;
|
||||||
// Release tags look like one of these:
|
// Release tags look like one of these:
|
||||||
|
|||||||
@ -174,7 +174,14 @@ steps:
|
|||||||
|
|
||||||
### JetBrains
|
### JetBrains
|
||||||
|
|
||||||
**NOTE:** JetBrains is only available for LTS versions on 11 or later.
|
**NOTE:** JetBrains is only available for LTS versions on 11 or later (11, 17, 21, etc.).
|
||||||
|
|
||||||
|
Not all minor LTS versions are guarenteed to be available, since JetBrains considers what to ship IntelliJ IDEA with, most commonly on JDK 11.
|
||||||
|
For example, `11.0.24` is not available but `11.0.16` is.
|
||||||
|
|
||||||
|
Versions are based on the GitHub tag on the [JetBrains Runtime releases page](https://github.com/JetBrains/JetBrainsRuntime/releases). As such, some tags may be formatted with
|
||||||
|
underscores (`11_0_13`) and others with dots (`11.0.13`). Conversion is automatically applied to the dot version format, so `11.0.13` is equivalent to `11_0_13`. Dot format
|
||||||
|
is more encouraged for consistency, but both are supported.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
steps:
|
steps:
|
||||||
@ -202,7 +209,8 @@ steps:
|
|||||||
- run: java -cp java HelloWorldApp
|
- run: java -cp java HelloWorldApp
|
||||||
```
|
```
|
||||||
|
|
||||||
JetBrains Package Types (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)):
|
You can specify your package type (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)) in the `package-type` parameter.
|
||||||
|
The available package types are:
|
||||||
|
|
||||||
- `jdk` - JBRSDK
|
- `jdk` - JBRSDK
|
||||||
- `jre` - JBR (Vanilla)
|
- `jre` - JBR (Vanilla)
|
||||||
|
|||||||
@ -96,12 +96,14 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
// GitHub API doesn't provide way to retrieve the count of pages to iterate so infinity loop
|
// GitHub API doesn't provide way to retrieve the count of pages to iterate so infinity loop
|
||||||
let page_index = 1;
|
let page_index = 1;
|
||||||
const rawVersions: IJetBrainsRawVersion[] = [];
|
const rawVersions: IJetBrainsRawVersion[] = [];
|
||||||
|
const bearerToken = process.env.GITHUB_TOKEN;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
const requestArguments = `per_page=100&page=${page_index}`;
|
const requestArguments = `per_page=100&page=${page_index}`;
|
||||||
const requestHeaders: OutgoingHttpHeaders = {};
|
const requestHeaders: OutgoingHttpHeaders = {};
|
||||||
|
|
||||||
if (process.env.GITHUB_TOKEN) {
|
if (bearerToken) {
|
||||||
requestHeaders['Authorization'] = `Bearer ${process.env.GITHUB_TOKEN}`;
|
requestHeaders['Authorization'] = `Bearer ${bearerToken}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
const rawUrl = `https://api.github.com/repos/JetBrains/JetBrainsRuntime/releases?${requestArguments}`;
|
||||||
@ -123,6 +125,10 @@ export class JetBrainsDistribution extends JavaBase {
|
|||||||
page_index++;
|
page_index++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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})));
|
||||||
|
|
||||||
const versions0 = rawVersions.map(async v => {
|
const versions0 = rawVersions.map(async v => {
|
||||||
// Release tags look like one of these:
|
// Release tags look like one of these:
|
||||||
// jbr-release-21.0.3b465.3
|
// jbr-release-21.0.3b465.3
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user