mirror of
https://github.com/actions/setup-java.git
synced 2024-12-01 21:00:56 -05:00
Fix Broken URLs, Add Additional Package Types
This commit is contained in:
parent
72649109a1
commit
8e2bc8fd07
3 changed files with 127 additions and 30 deletions
56
.github/workflows/e2e-versions.yml
vendored
56
.github/workflows/e2e-versions.yml
vendored
|
@ -71,11 +71,11 @@ jobs:
|
|||
with:
|
||||
java-version: ${{ matrix.version }}
|
||||
distribution: ${{ matrix.distribution }}
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Verify Java
|
||||
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
|
||||
shell: bash
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
setup-java-major-minor-versions:
|
||||
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
|
||||
|
@ -283,7 +283,8 @@ jobs:
|
|||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-13, windows-latest, ubuntu-latest]
|
||||
distribution: ['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine']
|
||||
distribution:
|
||||
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
|
||||
java-package: ['jre']
|
||||
version: ['17.0']
|
||||
include:
|
||||
|
@ -307,6 +308,55 @@ jobs:
|
|||
java-package: jre
|
||||
version: '8'
|
||||
os: windows-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jdk+jcef
|
||||
version: '11'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jdk+jcef
|
||||
version: '17'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jdk+jcef
|
||||
version: '21'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jre+jcef
|
||||
version: '11'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jre+jcef
|
||||
version: '17'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jre+jcef
|
||||
version: '21'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jdk+ft
|
||||
version: '11'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jdk+ft
|
||||
version: '17'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jdk+ft
|
||||
version: '21'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jre+ft
|
||||
version: '11'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jre+ft
|
||||
version: '17'
|
||||
os: ubuntu-latest
|
||||
- distribution: 'jetbrains'
|
||||
java-package: jre+ft
|
||||
version: '21'
|
||||
os: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
|
|
@ -173,7 +173,8 @@ steps:
|
|||
```
|
||||
|
||||
### JetBrains
|
||||
**NOTE:** JetBrains only provides jdk and is only available for LTS versions 11 or later. JCEF is not bundled with this distribution.
|
||||
|
||||
**NOTE:** JetBrains is only available for LTS versions on 11 or later.
|
||||
|
||||
```yaml
|
||||
steps:
|
||||
|
@ -194,12 +195,22 @@ steps:
|
|||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: 'jetbrains'
|
||||
java-version: '11'
|
||||
java-version: '17'
|
||||
package-type: 'jdk' # optional (jdk, jre, jdk+jcef, jre+jcef, jdk+ft, or jre+ft) - defaults to jdk
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
- run: java -cp java HelloWorldApp
|
||||
```
|
||||
|
||||
JetBrains Package Types (as shown in the [releases page](https://github.com/JetBrains/JetBrainsRuntime/releases/)):
|
||||
|
||||
- `jdk` - JBRSDK
|
||||
- `jre` - JBR (Vanilla)
|
||||
- `jdk+jcef` - JBRSDK with JCEF
|
||||
- `jre+jcef` - JBR with JCEF
|
||||
- `jdk+ft` - JBRSDK (FreeType)
|
||||
- `jre+ft` - JBR (FreeType)
|
||||
|
||||
### GraalVM
|
||||
**NOTE:** Oracle GraalVM is only available for JDK 17 and later.
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import {
|
|||
} from '../base-models';
|
||||
import {extractJdkFile, isVersionSatisfies} from '../../util';
|
||||
import {OutgoingHttpHeaders} from 'http';
|
||||
import {HttpCodes} from '@actions/http-client';
|
||||
|
||||
export class JetBrainsDistribution extends JavaBase {
|
||||
constructor(installerOptions: JavaInstallerOptions) {
|
||||
|
@ -44,7 +45,7 @@ export class JetBrainsDistribution extends JavaBase {
|
|||
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
|
||||
if (!resolvedFullVersion) {
|
||||
const availableOptions = versionsRaw
|
||||
.map(item => item.tag_name)
|
||||
.map(item => `${item.tag_name} (${item.semver}+${item.build})`)
|
||||
.join(', ');
|
||||
const availableOptionsMessage = availableOptions
|
||||
? `\nAvailable versions: ${availableOptions}`
|
||||
|
@ -122,49 +123,84 @@ export class JetBrainsDistribution extends JavaBase {
|
|||
page_index++;
|
||||
}
|
||||
|
||||
const versions0 = rawVersions.map(v => {
|
||||
const versions0 = rawVersions.map(async v => {
|
||||
// Release tags look like one of these:
|
||||
// jbr-release-21.0.3b465.3
|
||||
// jbr17-b87.7
|
||||
// jb11_0_11-b87.7
|
||||
// jbr11_0_15b2043.56
|
||||
// 11_0_11b1536.2
|
||||
// 11_0_11-b1522
|
||||
const tag = v.tag_name;
|
||||
|
||||
// Extract version string
|
||||
let vstring;
|
||||
|
||||
switch (tag.match(/-/g)?.length) {
|
||||
case 2:
|
||||
vstring = tag.substring(tag.lastIndexOf('-') + 1);
|
||||
break;
|
||||
case 1:
|
||||
vstring = tag.substring(2).replace(/-/g, '');
|
||||
break;
|
||||
case undefined: // 0
|
||||
vstring = tag.substring(3);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unrecognized tag_name: ${tag}`);
|
||||
}
|
||||
const vstring = tag
|
||||
.replace('jbr-release-', '')
|
||||
.replace('jbr', '')
|
||||
.replace('jb', '')
|
||||
.replace('-', '');
|
||||
|
||||
const vsplit = vstring.split('b');
|
||||
const semver = vsplit[0];
|
||||
let semver = vsplit[0];
|
||||
const build = +vsplit[1];
|
||||
|
||||
// Construct URL
|
||||
const url = `https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-${semver}-${platform}-${arch}-b${build}.tar.gz`;
|
||||
// Normalize semver
|
||||
if (!semver.includes('.') && !semver.includes('_'))
|
||||
semver = `${semver}.0.0`;
|
||||
|
||||
return {
|
||||
// Construct URL
|
||||
let type: string;
|
||||
switch (this.packageType ?? '') {
|
||||
case 'jre':
|
||||
type = 'jbr';
|
||||
break;
|
||||
case 'jdk+jcef':
|
||||
type = 'jbrsdk_jcef';
|
||||
break;
|
||||
case 'jre+jcef':
|
||||
type = 'jbr_jcef';
|
||||
break;
|
||||
case 'jdk+ft':
|
||||
type = 'jbrsdk_ft';
|
||||
break;
|
||||
case 'jre+ft':
|
||||
type = 'jbr_ft';
|
||||
break;
|
||||
default:
|
||||
type = 'jbrsdk';
|
||||
break;
|
||||
}
|
||||
|
||||
let url = `https://cache-redirector.jetbrains.com/intellij-jbr/${type}-${semver}-${platform}-${arch}-b${build}.tar.gz`;
|
||||
let include = false;
|
||||
|
||||
const res = await this.http.head(url);
|
||||
if (res.message.statusCode === HttpCodes.OK) {
|
||||
include = true;
|
||||
} else {
|
||||
url = `https://cache-redirector.jetbrains.com/intellij-jbr/${type}_nomod-${semver}-${platform}-${arch}-b${build}.tar.gz`;
|
||||
const res2 = await this.http.head(url);
|
||||
if (res2.message.statusCode === HttpCodes.OK) {
|
||||
include = true;
|
||||
}
|
||||
}
|
||||
|
||||
const version = {
|
||||
tag_name: tag,
|
||||
semver: semver.replace(/_/g, '.'),
|
||||
build: build,
|
||||
url: url
|
||||
} as IJetBrainsVersion;
|
||||
|
||||
return {
|
||||
item: version,
|
||||
include: include
|
||||
};
|
||||
});
|
||||
|
||||
const versions = versions0.filter(async i => {
|
||||
const res = await this.http.head(i.url);
|
||||
return res.message.statusCode === 200;
|
||||
});
|
||||
const versions = await Promise.all(versions0).then(res =>
|
||||
res.filter(item => item.include).map(item => item.item)
|
||||
);
|
||||
|
||||
if (core.isDebug()) {
|
||||
core.startGroup('Print information about available versions');
|
||||
|
|
Loading…
Reference in a new issue