diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 9e9c6c1..ccaec6b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -245,12 +245,12 @@ jobs: if: runner.os == 'Windows' test-liberica: needs: test - name: Liberica (${{ matrix.java-version }}, '${{ matrix.version }}', ${{ matrix.os }}) + name: Liberica (${{ matrix.java-version }}, '${{ matrix.java-package }}', ${{ matrix.os }}) runs-on: ${{ matrix.os }} strategy: matrix: java-version: ['17', '21.0.2'] - version: ['', 'std', 'full'] + java-package: ['', 'jdk', 'jdk+fx'] os: [ubuntu-latest, macos-latest, windows-latest] steps: - uses: actions/checkout@v4 @@ -259,7 +259,7 @@ jobs: with: distribution: liberica java-version: ${{ matrix.java-version }} - version: ${{ matrix.version }} + java-package: ${{ matrix.java-package }} github-token: ${{ secrets.GITHUB_TOKEN }} - name: Check environment run: | diff --git a/README.md b/README.md index e42ecae..67bd032 100644 --- a/README.md +++ b/README.md @@ -189,6 +189,7 @@ can be replaced with: |-----------------|:--------:|-------------| | `java-version`
*(required)* | n/a | Java version | | `distribution` | `'graalvm'` | GraalVM distribution | +| `java-package` | `'jdk'` | The package type (`'jdk'` or `'jdk+fx'`). Currently applies to Liberica only. | | `github-token` | `'${{ github.token }}'` | Token for communication with the GitHub API. Please set this to `${{ secrets.GITHUB_TOKEN }}` (see [templates](#templates)) to allow the action to authenticate with the GitHub API, which helps reduce rate-limiting issues. | | `set-java-home` | `'true'` | If set to `'true'`, instructs the action to set `$JAVA_HOME` to the path of the GraalVM installation. Overrides any previous action or command that sets `$JAVA_HOME`. | | `cache` | `''` | Name of the build platform to cache dependencies. Turned off by default (`''`). It can also be `'maven'`, `'gradle'`, or `'sbt'` and works the same way as described in [actions/setup-java][setup-java-caching]. | @@ -197,7 +198,7 @@ can be replaced with: | `native-image-job-reports` *) | `'false'` | If set to `'true'`, post a job summary containing a Native Image build report. | | `native-image-pr-reports` *) | `'false'` | If set to `'true'`, post a comment containing a Native Image build report on pull requests. Requires `write` permissions for the [`pull-requests` scope][gha-permissions]. | | `components` | `''` | Comma-separated list of GraalVM components (e.g., `native-image` or `ruby,nodejs`) that will be installed by the [GraalVM Updater][gu]. | -| `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`
`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],
`mandrel-latest` or `latest` for the latest Mandrel stable release,
`std` (default) or `full` for Liberica| +| `version` | `''` | `X.Y.Z` (e.g., `22.3.0`) for a specific [GraalVM release][releases] up to `22.3.2`
`mandrel-X.Y.Z.W` or `X.Y.Z.W-Final` (e.g., `mandrel-21.3.0.0-Final` or `21.3.0.0-Final`) for a specific [Mandrel release][mandrel-releases],
`mandrel-latest` or `latest` for the latest Mandrel stable release. | | `gds-token` | `''` | Download token for the GraalVM Download Service. If a non-empty token is provided, the action will set up GraalVM Enterprise Edition (see [GraalVM EE template](#template-for-graalvm-enterprise-edition)). | **) Make sure that Native Image is used only once per build job. Otherwise, the report is only generated for the last Native Image build.* diff --git a/__tests__/liberica.test.ts b/__tests__/liberica.test.ts index 4396bf8..55d23fb 100644 --- a/__tests__/liberica.test.ts +++ b/__tests__/liberica.test.ts @@ -37,13 +37,13 @@ test('find latest JDK version', async () => { test('find asset URL', async () => { await expectURL('11.0.22+12', '', 'bellsoft-liberica-vm-openjdk11.0.22') - await expectURL('17.0.10+13', 'std', 'bellsoft-liberica-vm-openjdk17.0.10') + await expectURL('17.0.10+13', 'jdk', 'bellsoft-liberica-vm-openjdk17.0.10') if (!c.IS_LINUX) { - // This check can fail on Linux because there's no `full` version for aarch64 and/or musl + // This check can fail on Linux because there's no `jdk+fx` package for aarch64 and/or musl await expectURL( '21.0.2+14', - 'full', + 'jdk+fx', 'bellsoft-liberica-vm-full-openjdk21.0.2' ) } @@ -127,10 +127,10 @@ async function expectLatestToFail(pattern: string) { async function expectURL( javaVersion: string, - version: string, + javaPackage: string, expectedPrefix: string ) { - const url = await liberica.findLibericaURL(javaVersion, version) + const url = await liberica.findLibericaURL(javaVersion, javaPackage) expect(url).toBeDefined() const parts = url.split('/') const file = parts[parts.length - 1] diff --git a/action.yml b/action.yml index bf73289..dece5ee 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ inputs: java-version: required: true description: 'Java version. See examples of supported syntax in the README file.' + java-package: + description: 'The package type (jdk or jdk+fx). Currently applies to Liberica only.' + required: false + default: 'jdk' distribution: description: 'GraalVM distribution. See the list of available distributions in the README file.' required: false diff --git a/dist/cleanup/index.js b/dist/cleanup/index.js index 10a77a2..413431b 100644 --- a/dist/cleanup/index.js +++ b/dist/cleanup/index.js @@ -92175,10 +92175,11 @@ else { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; +exports.INPUT_JAVA_PACKAGE = 'java-package'; exports.INPUT_DISTRIBUTION = 'distribution'; exports.INPUT_COMPONENTS = 'components'; exports.INPUT_GITHUB_TOKEN = 'github-token'; diff --git a/dist/main/index.js b/dist/main/index.js index 152a3f1..ed09bc2 100644 --- a/dist/main/index.js +++ b/dist/main/index.js @@ -92741,10 +92741,11 @@ function wrappy (fn, cb) { "use strict"; Object.defineProperty(exports, "__esModule", ({ value: true })); -exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; +exports.ERROR_HINT = exports.ERROR_REQUEST = exports.EVENT_NAME_PULL_REQUEST = exports.ENV_GITHUB_EVENT_NAME = exports.GDS_GRAALVM_PRODUCT_ID = exports.GDS_BASE = exports.MANDREL_NAMESPACE = exports.GRAALVM_RELEASES_REPO = exports.GRAALVM_PLATFORM = exports.GRAALVM_GH_USER = exports.GRAALVM_FILE_EXTENSION = exports.GRAALVM_ARCH = exports.JDK_HOME_SUFFIX = exports.JDK_PLATFORM = exports.JDK_ARCH = exports.VERSION_LATEST = exports.VERSION_DEV = exports.DISTRIBUTION_LIBERICA = exports.DISTRIBUTION_MANDREL = exports.DISTRIBUTION_GRAALVM_COMMUNITY = exports.DISTRIBUTION_GRAALVM = exports.EXECUTABLE_SUFFIX = exports.IS_WINDOWS = exports.IS_MACOS = exports.IS_LINUX = exports.INPUT_NI_MUSL = exports.INPUT_CHECK_FOR_UPDATES = exports.INPUT_CACHE = exports.INPUT_SET_JAVA_HOME = exports.INPUT_GITHUB_TOKEN = exports.INPUT_COMPONENTS = exports.INPUT_DISTRIBUTION = exports.INPUT_JAVA_PACKAGE = exports.INPUT_JAVA_VERSION = exports.INPUT_GDS_TOKEN = exports.INPUT_VERSION = void 0; exports.INPUT_VERSION = 'version'; exports.INPUT_GDS_TOKEN = 'gds-token'; exports.INPUT_JAVA_VERSION = 'java-version'; +exports.INPUT_JAVA_PACKAGE = 'java-package'; exports.INPUT_DISTRIBUTION = 'distribution'; exports.INPUT_COMPONENTS = 'components'; exports.INPUT_GITHUB_TOKEN = 'github-token'; @@ -94254,11 +94255,11 @@ const LIBERICA_GH_USER = 'bell-sw'; const LIBERICA_RELEASES_REPO = 'LibericaNIK'; const LIBERICA_JDK_TAG_PREFIX = 'jdk-'; const LIBERICA_VM_PREFIX = 'bellsoft-liberica-vm-'; -function setUpLiberica(javaVersion, version) { +function setUpLiberica(javaVersion, javaPackage) { return __awaiter(this, void 0, void 0, function* () { const resolvedJavaVersion = yield findLatestLibericaJavaVersion(javaVersion); - const downloadUrl = yield findLibericaURL(resolvedJavaVersion, version); - const toolName = determineToolName(javaVersion, version); + const downloadUrl = yield findLibericaURL(resolvedJavaVersion, javaPackage); + const toolName = determineToolName(javaVersion, javaPackage); return (0, utils_1.downloadExtractAndCacheJDK)(() => __awaiter(this, void 0, void 0, function* () { return (0, tool_cache_1.downloadTool)(downloadUrl); }), toolName, javaVersion); }); } @@ -94287,11 +94288,11 @@ function findLatestLibericaJavaVersion(javaVersion) { }); } exports.findLatestLibericaJavaVersion = findLatestLibericaJavaVersion; -function findLibericaURL(javaVersion, version) { +function findLibericaURL(javaVersion, javaPackage) { return __awaiter(this, void 0, void 0, function* () { const release = yield (0, utils_1.getTaggedRelease)(LIBERICA_GH_USER, LIBERICA_RELEASES_REPO, LIBERICA_JDK_TAG_PREFIX + javaVersion); const platform = determinePlatformPart(); - const assetPrefix = `${LIBERICA_VM_PREFIX}${determineToolVersionPart(version)}openjdk${javaVersion}`; + const assetPrefix = `${LIBERICA_VM_PREFIX}${determineVariantPart(javaPackage)}openjdk${javaVersion}`; const assetSuffix = `-${platform}${c.GRAALVM_FILE_EXTENSION}`; for (const asset of release.assets) { if (asset.name.startsWith(assetPrefix) && @@ -94299,15 +94300,17 @@ function findLibericaURL(javaVersion, version) { return asset.browser_download_url; } } - throw new Error(`Unable to find asset for java-version: ${javaVersion}, version: ${version}, platform: ${platform}`); + throw new Error(`Unable to find asset for java-version: ${javaVersion}, java-package: ${javaPackage}, platform: ${platform}`); }); } exports.findLibericaURL = findLibericaURL; -function determineToolVersionPart(version) { - return version === 'std' || version === '' ? '' : `${version}-`; +function determineToolName(javaVersion, javaPackage) { + const variant = determineVariantPart(javaPackage); + const platform = determinePlatformPart(); + return `${LIBERICA_VM_PREFIX}${variant}openjdk${javaVersion}-${platform}`; } -function determineToolName(javaVersion, version) { - return `${LIBERICA_VM_PREFIX}${determineToolVersionPart(version)}openjdk${javaVersion}-${determinePlatformPart()}`; +function determineVariantPart(javaPackage) { + return javaPackage !== null && javaPackage.includes('+fx') ? 'full-' : ''; } function determinePlatformPart() { if (isMuslBasedLinux()) { @@ -94391,6 +94394,7 @@ function run() { return __awaiter(this, void 0, void 0, function* () { try { const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, { required: true }); + const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE); const distribution = core.getInput(c.INPUT_DISTRIBUTION); const graalVMVersion = core.getInput(c.INPUT_VERSION); const gdsToken = core.getInput(c.INPUT_GDS_TOKEN); diff --git a/src/constants.ts b/src/constants.ts index 4b76c4c..11964e8 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -3,6 +3,7 @@ import * as otypes from '@octokit/types' export const INPUT_VERSION = 'version' export const INPUT_GDS_TOKEN = 'gds-token' export const INPUT_JAVA_VERSION = 'java-version' +export const INPUT_JAVA_PACKAGE = 'java-package' export const INPUT_DISTRIBUTION = 'distribution' export const INPUT_COMPONENTS = 'components' export const INPUT_GITHUB_TOKEN = 'github-token' diff --git a/src/liberica.ts b/src/liberica.ts index 532e60c..9e77c03 100644 --- a/src/liberica.ts +++ b/src/liberica.ts @@ -15,11 +15,11 @@ const LIBERICA_VM_PREFIX = 'bellsoft-liberica-vm-' export async function setUpLiberica( javaVersion: string, - version: string + javaPackage: string ): Promise { const resolvedJavaVersion = await findLatestLibericaJavaVersion(javaVersion) - const downloadUrl = await findLibericaURL(resolvedJavaVersion, version) - const toolName = determineToolName(javaVersion, version) + const downloadUrl = await findLibericaURL(resolvedJavaVersion, javaPackage) + const toolName = determineToolName(javaVersion, javaPackage) return downloadExtractAndCacheJDK( async () => downloadTool(downloadUrl), toolName, @@ -61,7 +61,7 @@ export async function findLatestLibericaJavaVersion( export async function findLibericaURL( javaVersion: string, - version: string + javaPackage: string ): Promise { const release = await getTaggedRelease( LIBERICA_GH_USER, @@ -69,8 +69,8 @@ export async function findLibericaURL( LIBERICA_JDK_TAG_PREFIX + javaVersion ) const platform = determinePlatformPart() - const assetPrefix = `${LIBERICA_VM_PREFIX}${determineToolVersionPart( - version + const assetPrefix = `${LIBERICA_VM_PREFIX}${determineVariantPart( + javaPackage )}openjdk${javaVersion}` const assetSuffix = `-${platform}${c.GRAALVM_FILE_EXTENSION}` for (const asset of release.assets) { @@ -82,18 +82,18 @@ export async function findLibericaURL( } } throw new Error( - `Unable to find asset for java-version: ${javaVersion}, version: ${version}, platform: ${platform}` + `Unable to find asset for java-version: ${javaVersion}, java-package: ${javaPackage}, platform: ${platform}` ) } -function determineToolVersionPart(version: string) { - return version === 'std' || version === '' ? '' : `${version}-` +function determineToolName(javaVersion: string, javaPackage: string) { + const variant = determineVariantPart(javaPackage) + const platform = determinePlatformPart() + return `${LIBERICA_VM_PREFIX}${variant}openjdk${javaVersion}-${platform}` } -function determineToolName(javaVersion: string, version: string) { - return `${LIBERICA_VM_PREFIX}${determineToolVersionPart( - version - )}openjdk${javaVersion}-${determinePlatformPart()}` +function determineVariantPart(javaPackage: string) { + return javaPackage !== null && javaPackage.includes('+fx') ? 'full-' : '' } function determinePlatformPart() { diff --git a/src/main.ts b/src/main.ts index 586712f..50ed996 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,6 +18,7 @@ import {exec} from '@actions/exec' async function run(): Promise { try { const javaVersion = core.getInput(c.INPUT_JAVA_VERSION, {required: true}) + const javaPackage = core.getInput(c.INPUT_JAVA_PACKAGE) const distribution = core.getInput(c.INPUT_DISTRIBUTION) const graalVMVersion = core.getInput(c.INPUT_VERSION) const gdsToken = core.getInput(c.INPUT_GDS_TOKEN) @@ -67,7 +68,7 @@ async function run(): Promise { graalVMHome = await setUpMandrel(graalVMVersion, javaVersion) break case c.DISTRIBUTION_LIBERICA: - graalVMHome = await setUpLiberica(javaVersion, graalVMVersion) + graalVMHome = await setUpLiberica(javaVersion, javaPackage) break case '': if (javaVersion === c.VERSION_DEV) {