Fix Broken URLs, Add Additional Package Types

This commit is contained in:
Gregory Mitchell 2024-11-09 02:26:11 +00:00 committed by GitHub
parent 72649109a1
commit 8e2bc8fd07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 127 additions and 30 deletions

View file

@ -71,11 +71,11 @@ jobs:
with: with:
java-version: ${{ matrix.version }} java-version: ${{ matrix.version }}
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify Java - name: Verify Java
run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}" run: bash __tests__/verify-java.sh "${{ matrix.version }}" "${{ steps.setup-java.outputs.path }}"
shell: bash shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
setup-java-major-minor-versions: setup-java-major-minor-versions:
name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }} name: ${{ matrix.distribution }} ${{ matrix.version }} (jdk-x64) - ${{ matrix.os }}
@ -283,7 +283,8 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-13, windows-latest, ubuntu-latest]
distribution: ['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine'] distribution:
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
java-package: ['jre'] java-package: ['jre']
version: ['17.0'] version: ['17.0']
include: include:
@ -307,6 +308,55 @@ jobs:
java-package: jre java-package: jre
version: '8' version: '8'
os: windows-latest 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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View file

@ -173,7 +173,8 @@ steps:
``` ```
### JetBrains ### 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 ```yaml
steps: steps:
@ -194,12 +195,22 @@ steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v4
with: with:
distribution: 'jetbrains' 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: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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/)):
- `jdk` - JBRSDK
- `jre` - JBR (Vanilla)
- `jdk+jcef` - JBRSDK with JCEF
- `jre+jcef` - JBR with JCEF
- `jdk+ft` - JBRSDK (FreeType)
- `jre+ft` - JBR (FreeType)
### GraalVM ### GraalVM
**NOTE:** Oracle GraalVM is only available for JDK 17 and later. **NOTE:** Oracle GraalVM is only available for JDK 17 and later.

View file

@ -14,6 +14,7 @@ import {
} from '../base-models'; } from '../base-models';
import {extractJdkFile, isVersionSatisfies} from '../../util'; import {extractJdkFile, isVersionSatisfies} from '../../util';
import {OutgoingHttpHeaders} from 'http'; import {OutgoingHttpHeaders} from 'http';
import {HttpCodes} from '@actions/http-client';
export class JetBrainsDistribution extends JavaBase { export class JetBrainsDistribution extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) { constructor(installerOptions: JavaInstallerOptions) {
@ -44,7 +45,7 @@ export class JetBrainsDistribution extends JavaBase {
satisfiedVersions.length > 0 ? satisfiedVersions[0] : null; satisfiedVersions.length > 0 ? satisfiedVersions[0] : null;
if (!resolvedFullVersion) { if (!resolvedFullVersion) {
const availableOptions = versionsRaw const availableOptions = versionsRaw
.map(item => item.tag_name) .map(item => `${item.tag_name} (${item.semver}+${item.build})`)
.join(', '); .join(', ');
const availableOptionsMessage = availableOptions const availableOptionsMessage = availableOptions
? `\nAvailable versions: ${availableOptions}` ? `\nAvailable versions: ${availableOptions}`
@ -122,49 +123,84 @@ export class JetBrainsDistribution extends JavaBase {
page_index++; page_index++;
} }
const versions0 = rawVersions.map(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
// jbr17-b87.7
// jb11_0_11-b87.7 // jb11_0_11-b87.7
// jbr11_0_15b2043.56 // jbr11_0_15b2043.56
// 11_0_11b1536.2
// 11_0_11-b1522
const tag = v.tag_name; const tag = v.tag_name;
// Extract version string // Extract version string
let vstring; const vstring = tag
.replace('jbr-release-', '')
switch (tag.match(/-/g)?.length) { .replace('jbr', '')
case 2: .replace('jb', '')
vstring = tag.substring(tag.lastIndexOf('-') + 1); .replace('-', '');
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 vsplit = vstring.split('b'); const vsplit = vstring.split('b');
const semver = vsplit[0]; let semver = vsplit[0];
const build = +vsplit[1]; const build = +vsplit[1];
// Construct URL // Normalize semver
const url = `https://cache-redirector.jetbrains.com/intellij-jbr/jbrsdk-${semver}-${platform}-${arch}-b${build}.tar.gz`; 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, tag_name: tag,
semver: semver.replace(/_/g, '.'), semver: semver.replace(/_/g, '.'),
build: build, build: build,
url: url url: url
} as IJetBrainsVersion; } as IJetBrainsVersion;
return {
item: version,
include: include
};
}); });
const versions = versions0.filter(async i => { const versions = await Promise.all(versions0).then(res =>
const res = await this.http.head(i.url); res.filter(item => item.include).map(item => item.item)
return res.message.statusCode === 200; );
});
if (core.isDebug()) { if (core.isDebug()) {
core.startGroup('Print information about available versions'); core.startGroup('Print information about available versions');