Compare commits

..

17 Commits

Author SHA1 Message Date
dependabot[bot]
a2c8d38afa Bump eslint from 8.57.0 to 9.38.0
Bumps [eslint](https://github.com/eslint/eslint) from 8.57.0 to 9.38.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](https://github.com/eslint/eslint/compare/v8.57.0...v9.38.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 9.38.0
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-18 18:05:41 +00:00
mahabaleshwars
46c56d6f92 Add GitHub Token Support for GraalVM and Refactor Code (#849)
* Code updated to let code accept github token and refactored the code.

* github token accept through environment variable

* fix test error

* audit fix commit

* update package-lock.json

* Update GraalVM Tests

* Lint Issue Resolve

* Update Test case for Windows

* update with enhance code and test
2025-11-18 12:04:23 -06:00
Christoph Langer
66b945764b Update SapMachine URLs (#955) 2025-11-17 10:33:06 -06:00
priya-kinthali
6ba5449b7d Enhance error logging for network failures to include endpoint/IP details, add retry mechanism and update workflows to use macos-15-intel (#946)
* enhance error logging and implement retry

* Replace macos-13 with macos-15-intel

* refactored code based on Copilot suggestions
2025-11-13 13:34:50 -06:00
the-mod
de5a937a1d adds microsoft openjdk25 builds (#927)
* adds microsoft java 25 build

adds microsoft java 25 build

* tests and formatting

* Add Microsoft distribution for version 25 on multiple OS
2025-10-27 15:17:49 -05:00
aparnajyothi-y
ead9eaa3cf Update Regex to Support All ASDF Versions for the supported distributions in tool-versions File (#767)
* Regex update to fix #719

* Check failures fix

* npm run format, npm run format-check & npm run build

* Regex update

* regex update

* fixed check failures

* updated regex

* regex update for all the versions

* regex and docmentation update

* Regex update

* format and doc update

* doc format update

* npm audit fix

* resolve conflicts

* resolve conflicts

* resolve conflicts

* doc update

* Java version upgrade
2025-09-16 13:23:22 -05:00
Chiranjib Swain
8c57fa3627 Clarify JAVA_HOME and PATH setup in README (#841)
* Update README to clarify JAVA_HOME and PATH setup

* Clarify instructions for setting up multiple JDKs in README
2025-09-16 13:19:02 -05:00
dependabot[bot]
a7ab372554 Bump prettier from 2.8.8 to 3.6.2 (#873)
* Bump prettier from 2.8.8 to 3.6.2

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.6.2.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.6.2)

---
updated-dependencies:
- dependency-name: prettier
  dependency-version: 3.6.2
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* doc update and check failure fix

* npm run format-check

* doc format update

* doc update

* doc update

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
2025-09-09 10:02:46 -05:00
lmvysakh
d0351b4837 Update documentation to use checkout and Java v5 (#903)
Co-authored-by: lmvysakh <lmvysakh@github.com>
2025-09-03 14:04:05 -05:00
dependabot[bot]
dded088883 Bump actions/checkout from 4 to 5 (#896)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-08-20 21:56:38 -05:00
Salman Chishti
0913e9a06e Upgrade to node 24 (#888)
* Upgrade to node 24

Upgrading action to node 24 since new runner version.

* fix tests

* Fix tests and licences

* format

* format x2

* Upgrade Node.js version in workflow files to 24.x

* check failure fix

* check failures fix

* Fix mock platform

---------

Co-authored-by: Aparna Jyothi <aparnajyothi-y@github.com>
Co-authored-by: Haritha <73516759+HarithaVattikuti@users.noreply.github.com>
2025-08-20 14:07:47 -05:00
gowridurgad
e9343db97e Bumps form-data (#887)
Co-authored-by: “gowridurgad” <“hgowridurgad@github.com>
2025-07-30 14:34:56 -05:00
dependabot[bot]
ae2b61dbc6 Bump undici from 5.28.5 to 5.29.0 (#833)
* Bump undici from 5.28.5 to 5.29.0

Bumps [undici](https://github.com/nodejs/undici) from 5.28.5 to 5.29.0.
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](https://github.com/nodejs/undici/compare/v5.28.5...v5.29.0)

---
updated-dependencies:
- dependency-name: undici
  dependency-version: 5.29.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix CI failures

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2025-07-15 12:32:37 -05:00
dependabot[bot]
c190c18feb Bump eslint-plugin-jest from 27.9.0 to 29.0.1 (#730)
* Bump eslint-plugin-jest from 27.9.0 to 29.0.1

Bumps [eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest) from 27.9.0 to 28.11.0.
- [Release notes](https://github.com/jest-community/eslint-plugin-jest/releases)
- [Changelog](https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/jest-community/eslint-plugin-jest/compare/v27.9.0...v28.11.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-jest
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Fix failures

* Fix lint error

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: HarithaVattikuti <73516759+HarithaVattikuti@users.noreply.github.com>
2025-07-07 13:51:25 -05:00
Priya Gupta
67aec007b3 Fix: prevent default installation of JetBrains pre-releases (#859)
* fix: prevent default installation of JetBrains pre-releases

* simplify prerelease filter logic

* fix basic validation checks
2025-07-03 12:03:51 -05:00
gowridurgad
ebb356cc4e Improve Error Handling for Setup-Java Action to Help Debug Intermittent Failures (#848)
* error-handling

* Logic update

---------

Co-authored-by: “gowridurgad” <“hgowridurgad@github.com>
2025-06-23 12:32:03 -05:00
Haritha
f4f1212c88 Update publish-immutable-actions.yml (#798) 2025-04-16 11:13:56 -05:00
45 changed files with 3807 additions and 2511 deletions

View File

@@ -16,4 +16,4 @@ jobs:
name: Basic validation name: Basic validation
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
with: with:
node-version: '20.x' node-version: '24.x'

View File

@@ -16,4 +16,4 @@ jobs:
name: Check dist/ name: Check dist/
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main
with: with:
node-version: '20.x' node-version: '24.x'

View File

@@ -24,7 +24,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -51,13 +51,13 @@ jobs:
needs: gradle1-save needs: gradle1-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '11'
cache: gradle cache: gradle
cache-dependency-path: __tests__/cache/gradle1/*.gradle* cache-dependency-path: __tests__/cache/gradle1/*.gradle*
- name: Confirm that ~/.gradle/caches directory has been made - name: Confirm that ~/.gradle/caches directory has been made
@@ -76,13 +76,13 @@ jobs:
needs: gradle1-save needs: gradle1-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
with: with:
distribution: 'adopt' distribution: 'adopt'
java-version: '17' java-version: '11'
cache: gradle cache: gradle
cache-dependency-path: __tests__/cache/gradle2/*.gradle* cache-dependency-path: __tests__/cache/gradle2/*.gradle*
- name: Confirm that ~/.gradle/caches directory has not been made - name: Confirm that ~/.gradle/caches directory has not been made

View File

@@ -21,10 +21,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -46,11 +46,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
needs: gradle-save needs: gradle-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for gradle - name: Run setup-java with the cache for gradle
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -70,10 +70,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for maven - name: Run setup-java with the cache for maven
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -93,11 +93,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
needs: maven-save needs: maven-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for maven - name: Run setup-java with the cache for maven
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -121,10 +121,10 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-22.04] os: [macos-15-intel, windows-latest, ubuntu-22.04]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for sbt - name: Run setup-java with the cache for sbt
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -133,7 +133,7 @@ jobs:
java-version: '11' java-version: '11'
cache: sbt cache: sbt
- name: Setup SBT - name: Setup SBT
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
echo ""Installing SBT..."" echo ""Installing SBT...""
brew install sbt brew install sbt
@@ -141,7 +141,7 @@ jobs:
run: sbt update run: sbt update
- name: Check files to cache on macos-latest - name: Check files to cache on macos-latest
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"
@@ -170,11 +170,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-22.04] os: [macos-15-intel, windows-latest, ubuntu-22.04]
needs: sbt-save needs: sbt-save
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Run setup-java with the cache for sbt - name: Run setup-java with the cache for sbt
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -184,7 +184,7 @@ jobs:
cache: sbt cache: sbt
- name: Confirm that ~/Library/Caches/Coursier directory has been made - name: Confirm that ~/Library/Caches/Coursier directory has been made
if: matrix.os == 'macos-13' if: matrix.os == 'macos-15-intel'
run: | run: |
if [ ! -d ~/Library/Caches/Coursier ]; then if [ ! -d ~/Library/Caches/Coursier ]; then
echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly" echo "::error::The ~/Library/Caches/Coursier directory does not exist unexpectedly"

View File

@@ -21,7 +21,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Download Adopt OpenJDK file - name: Download Adopt OpenJDK file
run: | run: |
if ($IsLinux) { if ($IsLinux) {
@@ -58,7 +58,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Download Zulu OpenJDK file - name: Download Zulu OpenJDK file
run: | run: |
if ($IsLinux) { if ($IsLinux) {
@@ -95,7 +95,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Download Eclipse Temurin file - name: Download Eclipse Temurin file
run: | run: |
if ($IsLinux) { if ($IsLinux) {

View File

@@ -25,7 +25,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -60,7 +60,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Create fake settings.xml - name: Create fake settings.xml
run: | run: |
$xmlDirectory = Join-Path $HOME ".m2" $xmlDirectory = Join-Path $HOME ".m2"
@@ -96,7 +96,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Create fake settings.xml - name: Create fake settings.xml
run: | run: |
$xmlDirectory = Join-Path $HOME ".m2" $xmlDirectory = Join-Path $HOME ".m2"
@@ -133,7 +133,7 @@ jobs:
os: [macos-latest, windows-latest, ubuntu-latest] os: [macos-latest, windows-latest, ubuntu-latest]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java

View File

@@ -20,7 +20,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
distribution: [ distribution: [
'temurin', 'temurin',
'adopt', 'adopt',
@@ -39,10 +39,19 @@ jobs:
- distribution: microsoft - distribution: microsoft
version: 8 version: 8
- distribution: dragonwell - distribution: dragonwell
os: macos-13 os: macos-15-intel
include: include:
- distribution: microsoft
os: windows-latest
version: 25
- distribution: microsoft
os: ubuntu-latest
version: 25
- distribution: microsoft
os: macos-latest
version: 25
- distribution: oracle - distribution: oracle
os: macos-13 os: macos-15-intel
version: 17 version: 17
- distribution: oracle - distribution: oracle
os: windows-latest os: windows-latest
@@ -64,7 +73,7 @@ jobs:
version: '24-ea' version: '24-ea'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -114,7 +123,7 @@ jobs:
version: '17.0.7' version: '17.0.7'
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -149,7 +158,7 @@ jobs:
os: macos-latest os: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -185,7 +194,7 @@ jobs:
os: macos-latest os: macos-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -220,11 +229,11 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
version: ['17-ea', '15.0.0-ea.14'] version: ['17-ea', '15.0.0-ea.14']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -246,7 +255,7 @@ jobs:
version: ['17-ea'] version: ['17-ea']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -268,7 +277,7 @@ jobs:
version: ['17-ea', '21-ea'] version: ['17-ea', '21-ea']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -286,7 +295,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
os: [macos-13, windows-latest, ubuntu-latest] os: [macos-15-intel, windows-latest, ubuntu-latest]
distribution: distribution:
['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains'] ['temurin', 'zulu', 'liberica', 'semeru', 'sapmachine', 'jetbrains']
java-package: ['jre'] java-package: ['jre']
@@ -355,7 +364,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -383,7 +392,7 @@ jobs:
version: ['11'] version: ['11']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: setup-java - name: setup-java
uses: ./ uses: ./
id: setup-java id: setup-java
@@ -406,7 +415,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "17" > .java-version run: echo "17" > .java-version
@@ -435,7 +444,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "11" > .java-version run: echo "11" > .java-version
@@ -463,7 +472,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "17.0.10" > .java-version run: echo "17.0.10" > .java-version
@@ -491,7 +500,7 @@ jobs:
java-version-file: ['.java-version', '.tool-versions'] java-version-file: ['.java-version', '.tool-versions']
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Create .java-version file - name: Create .java-version file
shell: bash shell: bash
run: echo "openjdk64-17.0.10" > .java-version run: echo "openjdk64-17.0.10" > .java-version

View File

@@ -2,7 +2,8 @@ name: 'Publish Immutable Action Version'
on: on:
release: release:
types: [published] types: [released]
workflow_dispatch:
jobs: jobs:
publish: publish:
@@ -14,7 +15,7 @@ jobs:
steps: steps:
- name: Checking out - name: Checking out
uses: actions/checkout@v4 uses: actions/checkout@v5
- name: Publish - name: Publish
id: publish id: publish
uses: actions/publish-immutable-action@v0.0.4 uses: actions/publish-immutable-action@v0.0.4

View File

@@ -1,6 +1,6 @@
--- ---
name: "@types/node" name: "@types/node"
version: 20.11.24 version: 24.1.0
type: npm type: npm
summary: TypeScript definitions for node summary: TypeScript definitions for node
homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node

View File

@@ -1,6 +1,6 @@
--- ---
name: form-data name: form-data
version: 4.0.5 version: 4.0.4
type: npm type: npm
summary: A library to create readable "multipart/form-data" streams. Can be used to summary: A library to create readable "multipart/form-data" streams. Can be used to
submit forms and file uploads to other web applications. submit forms and file uploads to other web applications.

View File

@@ -1,15 +1,17 @@
--- ---
name: undici-types name: undici-types
version: 5.26.5 version: 7.8.0
type: npm type: npm
summary: A stand-alone types package for Undici summary: A stand-alone types package for Undici
homepage: https://undici.nodejs.org homepage: https://undici.nodejs.org
license: mit license: mit
licenses: licenses:
- sources: Auto-generated MIT license text - sources: LICENSE
text: | text: |
MIT License MIT License
Copyright (c) Matteo Collina and Undici contributors
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights in the Software without restriction, including without limitation the rights

View File

@@ -18,11 +18,20 @@ The `setup-java` action provides the following functionality for GitHub Actions
This action allows you to work with Java and Scala projects. This action allows you to work with Java and Scala projects.
## Breaking changes in V5
- Upgraded action from node20 to node24
> Make sure your runner is on version v2.327.1 or later to ensure compatibility with this release [Release Notes](https://github.com/actions/runner/releases/tag/v2.327.1)
For more details, see the full release notes on the [releases page](https://github.com/actions/setup-java/releases/tag/v5.0.0)
## V2 vs V1 ## V2 vs V1
- V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK. - V2 supports custom distributions and provides support for Azul Zulu OpenJDK, Eclipse Temurin and AdoptOpenJDK out of the box. V1 supports only Azul Zulu OpenJDK.
- V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2. - V2 requires you to specify distribution along with the version. V1 defaults to Azul Zulu OpenJDK, only version input is required. Follow [the migration guide](docs/switching-to-v2.md) to switch from V1 to V2.
For information about the latest releases, recent updates, and newly supported distributions, please refer to the `setup-java` [Releases](https://github.com/actions/setup-java/releases).
## Usage ## Usage
- `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified. - `java-version`: The Java version that is going to be set up. Takes a whole or [semver](#supported-version-syntax) Java version. If not specified, the action will expect `java-version-file` input to be specified.
@@ -69,8 +78,8 @@ This action allows you to work with Java and Scala projects.
#### Eclipse Temurin #### Eclipse Temurin
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' # See 'Supported distributions' for available options distribution: 'temurin' # See 'Supported distributions' for available options
java-version: '21' java-version: '21'
@@ -80,8 +89,8 @@ steps:
#### Azul Zulu OpenJDK #### Azul Zulu OpenJDK
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'zulu' # See 'Supported distributions' for available options distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '21' java-version: '21'
@@ -136,8 +145,8 @@ The cache input is optional, and caching is turned off by default.
#### Caching gradle dependencies #### Caching gradle dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -151,8 +160,8 @@ steps:
#### Caching maven dependencies #### Caching maven dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -165,8 +174,8 @@ steps:
#### Caching sbt dependencies #### Caching sbt dependencies
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -185,8 +194,8 @@ Usually, cache gets downloaded in multiple segments of fixed sizes. Sometimes, a
env: env:
SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5' SEGMENT_DOWNLOAD_TIMEOUT_MINS: '5'
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -205,8 +214,8 @@ For Java distributions that are not cached on Hosted images, `check-latest` alwa
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -224,9 +233,9 @@ jobs:
java: [ '8', '11', '17', '21' ] java: [ '8', '11', '17', '21' ]
name: Java ${{ matrix.Java }} sample name: Java ${{ matrix.Java }} sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@@ -235,11 +244,11 @@ jobs:
### Install multiple JDKs ### Install multiple JDKs
All versions are added to the PATH. The last version will be used and available globally. Other Java versions can be accessed through env variables with such specification as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. All configured Java versions are added to the PATH. The last one added to the PATH (i.e., the last JDK set up by this action) will be used as the default and available globally. Other Java versions can be accessed through environment variables such as 'JAVA_HOME_{{ MAJOR_VERSION }}_{{ ARCHITECTURE }}'. To use a specific Java version, set the JAVA_HOME environment variable accordingly and prepend its bin directory to the PATH to ensure it takes priority during execution.
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,47 @@
[ [
{
"version": "25.0.0",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
},
{
"filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
"arch": "aarch64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
}
]
},
{ {
"version": "21.0.0", "version": "21.0.0",
"stable": true, "stable": true,

View File

@@ -191,7 +191,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const installerOptions: JavaInstallerOptions = { const installerOptions: JavaInstallerOptions = {
version: '17', version: '17',

View File

@@ -287,7 +287,7 @@ describe('setupJava', () => {
spyCoreSetOutput = jest.spyOn(core, 'setOutput'); spyCoreSetOutput = jest.spyOn(core, 'setOutput');
spyCoreSetOutput.mockImplementation(() => undefined); spyCoreSetOutput.mockImplementation(() => undefined);
jest.spyOn(os, 'arch').mockReturnValue('x86'); jest.spyOn(os, 'arch').mockReturnValue('x86' as ReturnType<typeof os.arch>);
}); });
afterEach(() => { afterEach(() => {

View File

@@ -150,9 +150,8 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
version await distribution['findPackageForDownload'](version);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
}); });
@@ -203,29 +202,27 @@ describe('getAvailableVersions', () => {
}); });
it.each([ it.each([
['arm64', 'aarch64'], ['amd64', 'x64'],
['amd64', 'x64'] ['arm64', 'aarch64']
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const version = '17'; const distribution = new CorrettoDistribution({
const installerOptions: JavaInstallerOptions = { version: '17',
version,
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
checkLatest: false checkLatest: false
}; });
const distribution = new CorrettoDistribution(installerOptions);
mockPlatform(distribution, 'macos'); mockPlatform(distribution, 'macos');
const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`; const expectedLink = `https://corretto.aws/downloads/resources/17.0.2.8.1/amazon-corretto-17.0.2.8.1-macosx-${distroArch}.tar.gz`;
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
version await distribution['findPackageForDownload']('17');
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View File

@@ -206,9 +206,8 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
jdkVersion await distribution['findPackageForDownload'](jdkVersion);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

File diff suppressed because it is too large Load Diff

View File

@@ -41,9 +41,7 @@ describe('getAvailableVersions', () => {
expect(availableVersions).not.toBeNull(); expect(availableVersions).not.toBeNull();
const length = const length =
os.platform() === 'win32' os.platform() === 'win32' ? manifestData.length : manifestData.length + 2;
? manifestData.length - 1
: manifestData.length + 1;
expect(availableVersions.length).toBe(length); expect(availableVersions.length).toBe(length);
}, 10_000); }, 10_000);
}); });
@@ -78,9 +76,8 @@ describe('findPackageForDownload', () => {
checkLatest: false checkLatest: false
}); });
distribution['getAvailableVersions'] = async () => manifestData as any; distribution['getAvailableVersions'] = async () => manifestData as any;
const resolvedVersion = await distribution['findPackageForDownload']( const resolvedVersion =
input await distribution['findPackageForDownload'](input);
);
const url = resolvedVersion.url; const url = resolvedVersion.url;
const options = {method: 'HEAD'}; const options = {method: 'HEAD'};

View File

@@ -105,9 +105,11 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distributions = new LibericaDistributions({
version: '17', version: '17',
architecture: '', // to get default value architecture: '', // to get default value
packageType: 'jdk', packageType: 'jdk',
@@ -117,11 +119,11 @@ describe('getAvailableVersions', () => {
const additionalParams = const additionalParams =
'&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' + '&installation-type=archive&fields=downloadUrl%2Cversion%2CfeatureVersion%2CinterimVersion%2C' +
'updateVersion%2CbuildVersion'; 'updateVersion%2CbuildVersion';
distribution['getPlatformOption'] = () => 'macos'; distributions['getPlatformOption'] = () => 'macos';
const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`; const buildUrl = `https://api.bell-sw.com/v1/liberica/releases?os=macos&bundle-type=jdk&bitness=${distroArch.bitness}&arch=${distroArch.arch}&build-type=all${additionalParams}`;
await distribution['getAvailableVersions'](); await distributions['getAvailableVersions']();
expect(spyHttpClient.mock.calls).toHaveLength(1); expect(spyHttpClient.mock.calls).toHaveLength(1);
expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl); expect(spyHttpClient.mock.calls[0][0]).toBe(buildUrl);

View File

@@ -105,7 +105,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',

View File

@@ -105,7 +105,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new LibericaDistributions({ const distribution = new LibericaDistributions({
version: '17', version: '17',

View File

@@ -29,6 +29,11 @@ describe('findPackageForDownload', () => {
}); });
it.each([ it.each([
[
'25.x',
'25.0.0',
'https://aka.ms/download-jdk/microsoft-jdk-25.0.0-{{OS_TYPE}}-x64.{{ARCHIVE_TYPE}}'
],
[ [
'21.x', '21.x',
'21.0.0', '21.0.0',
@@ -95,7 +100,9 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('darwin'); jest.spyOn(os, 'platform').mockReturnValue('darwin');
const version = '17'; const version = '17';
@@ -119,7 +126,9 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('linux'); jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '17'; const version = '17';
@@ -143,7 +152,9 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('win32'); jest.spyOn(os, 'platform').mockReturnValue('win32');
const version = '17'; const version = '17';

View File

@@ -95,7 +95,9 @@ describe('findPackageForDownload', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
jest.spyOn(os, 'platform').mockReturnValue('linux'); jest.spyOn(os, 'platform').mockReturnValue('linux');
const version = '18'; const version = '18';

View File

@@ -61,9 +61,8 @@ describe('getAvailableVersions', () => {
mockPlatform(distribution, 'linux'); mockPlatform(distribution, 'linux');
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
version await distribution['findPackageForDownload'](version);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe( expect(availableVersion.url).toBe(
'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz' 'https://github.com/SAP/SapMachine/releases/download/sapmachine-17.0.10/sapmachine-jdk-17.0.10_linux-x64_bin.tar.gz'
@@ -230,9 +229,8 @@ describe('getAvailableVersions', () => {
}); });
mockPlatform(distribution, platform); mockPlatform(distribution, platform);
const availableVersion = await distribution['findPackageForDownload']( const availableVersion =
normalizedVersion await distribution['findPackageForDownload'](normalizedVersion);
);
expect(availableVersion).not.toBeNull(); expect(availableVersion).not.toBeNull();
expect(availableVersion.url).toBe(expectedLink); expect(availableVersion.url).toBe(expectedLink);
} }

View File

@@ -147,7 +147,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: string) => { async (osArch: string, distroArch: string) => {
jest.spyOn(os, 'arch').mockReturnValue(distroArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const installerOptions: JavaInstallerOptions = { const installerOptions: JavaInstallerOptions = {
version: '17', version: '17',

View File

@@ -1,5 +1,4 @@
import {HttpClient} from '@actions/http-client'; import {HttpClient} from '@actions/http-client';
import * as semver from 'semver';
import {ZuluDistribution} from '../../src/distributions/zulu/installer'; import {ZuluDistribution} from '../../src/distributions/zulu/installer';
import {IZuluVersions} from '../../src/distributions/zulu/models'; import {IZuluVersions} from '../../src/distributions/zulu/models';
import * as utils from '../../src/util'; import * as utils from '../../src/util';
@@ -126,7 +125,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',

View File

@@ -126,7 +126,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',
@@ -135,7 +137,9 @@ describe('getAvailableVersions', () => {
checkLatest: false checkLatest: false
}); });
distribution['getPlatformOption'] = () => 'linux'; distribution['getPlatformOption'] = () => 'linux';
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=zip&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`; // Override extension for linux default arch case to match util behavior
spyUtilGetDownloadArchiveExtension.mockReturnValue('tar.gz');
const buildUrl = `https://api.azul.com/zulu/download/community/v1.0/bundles/?os=linux&ext=tar.gz&bundle_type=jdk&javafx=false&arch=${distroArch.arch}&hw_bitness=${distroArch.bitness}&release_status=ga`;
await distribution['getAvailableVersions'](); await distribution['getAvailableVersions']();

View File

@@ -126,7 +126,9 @@ describe('getAvailableVersions', () => {
])( ])(
'defaults to os.arch(): %s mapped to distro arch: %s', 'defaults to os.arch(): %s mapped to distro arch: %s',
async (osArch: string, distroArch: DistroArch) => { async (osArch: string, distroArch: DistroArch) => {
jest.spyOn(os, 'arch').mockReturnValue(osArch); jest
.spyOn(os, 'arch')
.mockReturnValue(osArch as ReturnType<typeof os.arch>);
const distribution = new ZuluDistribution({ const distribution = new ZuluDistribution({
version: '17', version: '17',

View File

@@ -81,6 +81,6 @@ outputs:
cache-hit: cache-hit:
description: 'A boolean value to indicate an exact match was found for the primary key' description: 'A boolean value to indicate an exact match was found for the primary key'
runs: runs:
using: 'node20' using: 'node24'
main: 'dist/setup/index.js' main: 'dist/setup/index.js'
post: 'dist/cleanup/index.js' post: 'dist/cleanup/index.js'

10
dist/cleanup/index.js vendored
View File

@@ -19167,7 +19167,7 @@ FormData.prototype.submit = function (params, cb) {
request.removeListener('error', callback); request.removeListener('error', callback);
request.removeListener('response', onResponse); request.removeListener('response', onResponse);
return cb.call(this, error, responce); return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
}; };
onResponse = callback.bind(this, null); onResponse = callback.bind(this, null);
@@ -19191,7 +19191,7 @@ FormData.prototype._error = function (err) {
FormData.prototype.toString = function () { FormData.prototype.toString = function () {
return '[object FormData]'; return '[object FormData]';
}; };
setToStringTag(FormData.prototype, 'FormData'); setToStringTag(FormData, 'FormData');
// Public API // Public API
module.exports = FormData; module.exports = FormData;
@@ -94704,7 +94704,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
const versionFileName = getFileName(versionFile); const versionFileName = getFileName(versionFile);
if (versionFileName == '.tool-versions') { if (versionFileName == '.tool-versions') {
javaVersionRegExp = javaVersionRegExp =
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m; /^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
} }
else { else {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
@@ -94747,8 +94747,8 @@ function convertVersionToSemver(version) {
} }
exports.convertVersionToSemver = convertVersionToSemver; exports.convertVersionToSemver = convertVersionToSemver;
function getGitHubHttpHeaders() { function getGitHubHttpHeaders() {
const token = core.getInput('token'); const resolvedToken = core.getInput('token') || process.env.GITHUB_TOKEN;
const auth = !token ? undefined : `token ${token}`; const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers = { const headers = {
accept: 'application/vnd.github.VERSION.raw' accept: 'application/vnd.github.VERSION.raw'
}; };

299
dist/setup/index.js vendored
View File

@@ -19167,7 +19167,7 @@ FormData.prototype.submit = function (params, cb) {
request.removeListener('error', callback); request.removeListener('error', callback);
request.removeListener('response', onResponse); request.removeListener('response', onResponse);
return cb.call(this, error, responce); return cb.call(this, error, responce); // eslint-disable-line no-invalid-this
}; };
onResponse = callback.bind(this, null); onResponse = callback.bind(this, null);
@@ -19191,7 +19191,7 @@ FormData.prototype._error = function (err) {
FormData.prototype.toString = function () { FormData.prototype.toString = function () {
return '[object FormData]'; return '[object FormData]';
}; };
setToStringTag(FormData.prototype, 'FormData'); setToStringTag(FormData, 'FormData');
// Public API // Public API
module.exports = FormData; module.exports = FormData;
@@ -129856,6 +129856,7 @@ class JavaBase {
this.checkLatest = installerOptions.checkLatest; this.checkLatest = installerOptions.checkLatest;
} }
setupJava() { setupJava() {
var _a, _b;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
let foundJava = this.findInToolcache(); let foundJava = this.findInToolcache();
if (foundJava && !this.checkLatest) { if (foundJava && !this.checkLatest) {
@@ -129863,17 +129864,106 @@ class JavaBase {
} }
else { else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
const javaRelease = yield this.findPackageForDownload(this.version); const MAX_RETRIES = 4;
core.info(`Resolved latest version as ${javaRelease.version}`); const RETRY_DELAY_MS = 2000;
if ((foundJava === null || foundJava === void 0 ? void 0 : foundJava.version) === javaRelease.version) { const retryableCodes = [
core.info(`Resolved Java ${foundJava.version} from tool-cache`); 'ETIMEDOUT',
} 'ECONNRESET',
else { 'ENOTFOUND',
core.info('Trying to download...'); 'ECONNREFUSED'
foundJava = yield this.downloadTool(javaRelease); ];
core.info(`Java ${foundJava.version} was downloaded`); let retries = MAX_RETRIES;
while (retries > 0) {
try {
// Clear console timers before each attempt to prevent conflicts
if (retries < MAX_RETRIES && core.isDebug()) {
const consoleAny = console;
(_b = (_a = consoleAny._times) === null || _a === void 0 ? void 0 : _a.clear) === null || _b === void 0 ? void 0 : _b.call(_a);
}
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) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
}
else {
core.info('Trying to download...');
foundJava = yield this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
}
break;
}
catch (error) {
retries--;
// Check if error is retryable (including aggregate errors)
const isRetryable = (error instanceof tc.HTTPError &&
error.httpStatusCode &&
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
retryableCodes.includes(error === null || error === void 0 ? void 0 : error.code) ||
((error === null || error === void 0 ? void 0 : error.errors) &&
Array.isArray(error.errors) &&
error.errors.some((err) => retryableCodes.includes(err === null || err === void 0 ? void 0 : err.code)));
if (retries > 0 && isRetryable) {
core.debug(`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`);
yield new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue;
}
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 if (error && error.errors && Array.isArray(error.errors)) {
core.error(`Java setup failed due to network or configuration error(s)`);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
for (const err of error.errors) {
const endpoint = (err === null || err === void 0 ? void 0 : err.address) || (err === null || err === void 0 ? void 0 : err.hostname) || '';
const port = (err === null || err === void 0 ? void 0 : err.port) ? `:${err.port}` : '';
const message = (err === null || err === void 0 ? void 0 : err.message) || 'Aggregate error';
const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo = err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage);
core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
}
else {
const message = error instanceof Error ? error.message : JSON.stringify(error);
core.error(`Java setup process failed due to: ${message}`);
if (typeof (error === null || error === void 0 ? void 0 : error.code) === 'string') {
core.debug(error.stack);
}
const errorDetails = Object.assign({ name: error.name, message: error.message }, Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {}));
Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
throw error;
}
} }
} }
if (!foundJava) {
throw new Error('Failed to resolve Java version');
}
// JDK folder may contain postfix "Contents/Home" on macOS // JDK folder may contain postfix "Contents/Home" on macOS
const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX); const macOSPostfixPath = path_1.default.join(foundJava.path, constants_1.MACOS_JAVA_CONTENT_POSTFIX);
if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) { if (process.platform === 'darwin' && fs.existsSync(macOSPostfixPath)) {
@@ -130502,37 +130592,56 @@ const tc = __importStar(__nccwpck_require__(27784));
const fs_1 = __importDefault(__nccwpck_require__(57147)); const fs_1 = __importDefault(__nccwpck_require__(57147));
const path_1 = __importDefault(__nccwpck_require__(71017)); const path_1 = __importDefault(__nccwpck_require__(71017));
const base_installer_1 = __nccwpck_require__(59741); const base_installer_1 = __nccwpck_require__(59741);
const util_1 = __nccwpck_require__(92629);
const http_client_1 = __nccwpck_require__(96255); const http_client_1 = __nccwpck_require__(96255);
const util_1 = __nccwpck_require__(92629);
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm'; const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform; const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
const GRAALVM_MIN_VERSION = 17;
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'];
class GraalVMDistribution extends base_installer_1.JavaBase { class GraalVMDistribution extends base_installer_1.JavaBase {
constructor(installerOptions) { constructor(installerOptions) {
super('GraalVM', installerOptions); super('GraalVM', installerOptions);
} }
downloadTool(javaRelease) { downloadTool(javaRelease) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`); try {
let javaArchivePath = yield tc.downloadTool(javaRelease.url); core.info(`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`);
core.info(`Extracting Java archive...`); let javaArchivePath = yield tc.downloadTool(javaRelease.url);
const extension = (0, util_1.getDownloadArchiveExtension)(); core.info(`Extracting Java archive...`);
if (process.platform === 'win32') { const extension = (0, util_1.getDownloadArchiveExtension)();
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath); if (IS_WINDOWS) {
javaArchivePath = (0, util_1.renameWinArchive)(javaArchivePath);
}
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
// Add validation for extracted path
if (!fs_1.default.existsSync(extractedJavaPath)) {
throw new Error(`Extraction failed: path ${extractedJavaPath} does not exist`);
}
const dirContents = fs_1.default.readdirSync(extractedJavaPath);
if (dirContents.length === 0) {
throw new Error('Extraction failed: no files found in extracted directory');
}
const archivePath = path_1.default.join(extractedJavaPath, dirContents[0]);
const version = this.getToolcacheVersionName(javaRelease.version);
const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
return { version: javaRelease.version, path: javaPath };
}
catch (error) {
core.error(`Failed to download and extract GraalVM: ${error}`);
throw error;
} }
const extractedJavaPath = yield (0, util_1.extractJdkFile)(javaArchivePath, extension);
const archiveName = fs_1.default.readdirSync(extractedJavaPath)[0];
const archivePath = path_1.default.join(extractedJavaPath, archiveName);
const version = this.getToolcacheVersionName(javaRelease.version);
const javaPath = yield tc.cacheDir(archivePath, this.toolcacheFolderName, version, this.architecture);
return { version: javaRelease.version, path: javaPath };
}); });
} }
findPackageForDownload(range) { findPackageForDownload(range) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
// Add input validation
if (!range || typeof range !== 'string') {
throw new Error('Version range is required and must be a string');
}
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
if (arch !== 'x64' && arch !== 'aarch64') { if (!SUPPORTED_ARCHITECTURES.includes(arch)) {
throw new Error(`Unsupported architecture: ${this.architecture}`); throw new Error(`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`);
} }
if (!this.stable) { if (!this.stable) {
return this.findEABuildDownloadUrl(`${range}-ea`); return this.findEABuildDownloadUrl(`${range}-ea`);
@@ -130542,81 +130651,104 @@ class GraalVMDistribution extends base_installer_1.JavaBase {
} }
const platform = this.getPlatform(); const platform = this.getPlatform();
const extension = (0, util_1.getDownloadArchiveExtension)(); const extension = (0, util_1.getDownloadArchiveExtension)();
let major; const major = range.includes('.') ? range.split('.')[0] : range;
let fileUrl; const majorVersion = parseInt(major);
if (range.includes('.')) { if (isNaN(majorVersion)) {
major = range.split('.')[0]; throw new Error(`Invalid version format: ${range}`);
fileUrl = `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
} }
else { if (majorVersion < GRAALVM_MIN_VERSION) {
major = range; throw new Error(`GraalVM is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`);
fileUrl = `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
}
if (parseInt(major) < 17) {
throw new Error('GraalVM is only supported for JDK 17 and later');
} }
const fileUrl = this.constructFileUrl(range, major, platform, arch, extension);
const response = yield this.http.head(fileUrl); const response = yield this.http.head(fileUrl);
if (response.message.statusCode === http_client_1.HttpCodes.NotFound) { this.handleHttpResponse(response, range);
throw new Error(`Could not find GraalVM for SemVer ${range}`);
}
if (response.message.statusCode !== http_client_1.HttpCodes.OK) {
throw new Error(`Http request for GraalVM failed with status code: ${response.message.statusCode}`);
}
return { url: fileUrl, version: range }; return { url: fileUrl, version: range };
}); });
} }
constructFileUrl(range, major, platform, arch, extension) {
return range.includes('.')
? `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`
: `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
}
handleHttpResponse(response, range) {
const statusCode = response.message.statusCode;
if (statusCode === http_client_1.HttpCodes.NotFound) {
throw new Error(`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`);
}
if (statusCode === http_client_1.HttpCodes.Unauthorized ||
statusCode === http_client_1.HttpCodes.Forbidden) {
throw new Error(`Access denied when downloading GraalVM. Status code: ${statusCode}. Please check your credentials or permissions.`);
}
if (statusCode !== http_client_1.HttpCodes.OK) {
throw new Error(`HTTP request for GraalVM failed with status code: ${statusCode} (${response.message.statusMessage || 'Unknown error'})`);
}
}
findEABuildDownloadUrl(javaEaVersion) { findEABuildDownloadUrl(javaEaVersion) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
core.debug(`Searching for EA build: ${javaEaVersion}`);
const versions = yield this.fetchEAJson(javaEaVersion); const versions = yield this.fetchEAJson(javaEaVersion);
core.debug(`Found ${versions.length} EA versions`);
const latestVersion = versions.find(v => v.latest); const latestVersion = versions.find(v => v.latest);
if (!latestVersion) { if (!latestVersion) {
core.error(`Available versions: ${versions.map(v => v.version).join(', ')}`);
throw new Error(`Unable to find latest version for '${javaEaVersion}'`); throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
} }
core.debug(`Latest version found: ${latestVersion.version}`);
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
const file = latestVersion.files.find(f => f.arch === arch && f.platform === GRAALVM_PLATFORM); const file = latestVersion.files.find(f => f.arch === arch && f.platform === GRAALVM_PLATFORM);
if (!file || !file.filename.startsWith('graalvm-jdk-')) { if (!file) {
throw new Error(`Unable to find file metadata for '${javaEaVersion}'`); core.error(`Available files for architecture ${arch}: ${JSON.stringify(latestVersion.files)}`);
throw new Error(`Unable to find file for architecture '${arch}' and platform '${GRAALVM_PLATFORM}'`);
} }
if (!file.filename.startsWith('graalvm-jdk-')) {
throw new Error(`Invalid filename format: ${file.filename}. Expected to start with 'graalvm-jdk-'`);
}
const downloadUrl = `${latestVersion.download_base_url}${file.filename}`;
core.debug(`Download URL: ${downloadUrl}`);
return { return {
url: `${latestVersion.download_base_url}${file.filename}`, url: downloadUrl,
version: latestVersion.version version: latestVersion.version
}; };
}); });
} }
fetchEAJson(javaEaVersion) { fetchEAJson(javaEaVersion) {
var _a;
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const owner = 'graalvm'; const url = `https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/${javaEaVersion}.json?ref=main`;
const repository = 'oracle-graalvm-ea-builds';
const branch = 'main';
const filePath = `versions/${javaEaVersion}.json`;
const url = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
const headers = (0, util_1.getGitHubHttpHeaders)(); const headers = (0, util_1.getGitHubHttpHeaders)();
core.debug(`Trying to fetch available version info for GraalVM EA builds from '${url}'`); core.debug(`Trying to fetch available version info for GraalVM EA builds from '${url}'`);
let fetchedJson;
try { try {
fetchedJson = (yield this.http.getJson(url, headers)) const response = yield this.http.getJson(url, headers);
.result; if (!response.result) {
throw new Error(`No GraalVM EA build found for version '${javaEaVersion}'. Please check if the version is correct.`);
}
return response.result;
} }
catch (err) { catch (error) {
throw Error(`Fetching version info for GraalVM EA builds from '${url}' failed with the error: ${err.message}`); if (error instanceof Error) {
// Check if it's a 404 error (file not found)
if ((_a = error.message) === null || _a === void 0 ? void 0 : _a.includes('404')) {
throw new Error(`GraalVM EA version '${javaEaVersion}' not found. Please verify the version exists in the EA builds repository.`);
}
// Re-throw with more context
throw new Error(`Failed to fetch GraalVM EA version information for '${javaEaVersion}': ${error.message}`);
}
// If it's not an Error instance, throw a generic error
throw new Error(`Failed to fetch GraalVM EA version information for '${javaEaVersion}'`);
} }
if (fetchedJson === null) {
throw Error(`No GraalVM EA build found. Are you sure java-version: '${javaEaVersion}' is correct?`);
}
return fetchedJson;
}); });
} }
getPlatform(platform = process.platform) { getPlatform(platform = process.platform) {
switch (platform) { const platformMap = {
case 'darwin': darwin: 'macos',
return 'macos'; win32: 'windows',
case 'win32': linux: 'linux'
return 'windows'; };
case 'linux': const result = platformMap[platform];
return 'linux'; if (!result) {
default: throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
throw new Error(`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`);
} }
return result;
} }
} }
exports.GraalVMDistribution = GraalVMDistribution; exports.GraalVMDistribution = GraalVMDistribution;
@@ -130742,7 +130874,12 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
// url is identical except page_index so print it once for debug // url is identical except page_index so print it once for debug
core.debug(`Gathering available versions from '${rawUrl}'`); core.debug(`Gathering available versions from '${rawUrl}'`);
} }
const paginationPage = (yield this.http.getJson(rawUrl, requestHeaders)).result; 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);
if (!paginationPage || paginationPage.length === 0) { if (!paginationPage || paginationPage.length === 0) {
// break infinity loop because we have reached end of pagination // break infinity loop because we have reached end of pagination
break; break;
@@ -130750,9 +130887,11 @@ 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 if (this.stable) {
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60']; // Add versions not available from the API but are downloadable
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag }))); const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
rawVersions.push(...hidden.map(tag => ({ tag_name: tag, name: tag, prerelease: false })));
}
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:
@@ -130771,7 +130910,7 @@ class JetBrainsDistribution extends base_installer_1.JavaBase {
.replace('-', ''); .replace('-', '');
const vsplit = vstring.split('b'); const vsplit = vstring.split('b');
let semver = vsplit[0]; let semver = vsplit[0];
const build = +vsplit[1]; const build = vsplit[1];
// Normalize semver // Normalize semver
if (!semver.includes('.') && !semver.includes('_')) if (!semver.includes('.') && !semver.includes('_'))
semver = `${semver}.0.0`; semver = `${semver}.0.0`;
@@ -131255,7 +131394,7 @@ class MicrosoftDistributions extends base_installer_1.JavaBase {
} }
} }
catch (err) { catch (err) {
core.debug(`Http request for microsoft-openjdk-versions.json failed with status code: ${response === null || response === void 0 ? void 0 : response.statusCode}`); core.debug(`Http request for microsoft-openjdk-versions.json failed with status code: ${response === null || response === void 0 ? void 0 : response.statusCode}. Error: ${err}`);
return null; return null;
} }
if (response.result) { if (response.result) {
@@ -131490,9 +131629,9 @@ class SapMachineDistribution extends base_installer_1.JavaBase {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
const platform = this.getPlatformOption(); const platform = this.getPlatformOption();
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
let fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'); let fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sapmachine.io/assets/data/sapmachine-releases-all.json');
if (!fetchedReleasesJson) { if (!fetchedReleasesJson) {
fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages', (0, util_1.getGitHubHttpHeaders)()); fetchedReleasesJson = yield this.fetchReleasesFromUrl('https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json');
} }
if (!fetchedReleasesJson) { if (!fetchedReleasesJson) {
throw new Error(`Couldn't fetch SapMachine versions information from both primary and backup urls`); throw new Error(`Couldn't fetch SapMachine versions information from both primary and backup urls`);
@@ -132709,7 +132848,7 @@ function getVersionFromFileContent(content, distributionName, versionFile) {
const versionFileName = getFileName(versionFile); const versionFileName = getFileName(versionFile);
if (versionFileName == '.tool-versions') { if (versionFileName == '.tool-versions') {
javaVersionRegExp = javaVersionRegExp =
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m; /^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
} }
else { else {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
@@ -132752,8 +132891,8 @@ function convertVersionToSemver(version) {
} }
exports.convertVersionToSemver = convertVersionToSemver; exports.convertVersionToSemver = convertVersionToSemver;
function getGitHubHttpHeaders() { function getGitHubHttpHeaders() {
const token = core.getInput('token'); const resolvedToken = core.getInput('token') || process.env.GITHUB_TOKEN;
const auth = !token ? undefined : `token ${token}`; const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers = { const headers = {
accept: 'application/vnd.github.VERSION.raw' accept: 'application/vnd.github.VERSION.raw'
}; };

View File

@@ -31,8 +31,8 @@ Inputs `java-version` and `distribution` are mandatory and needs to be provided.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '21' java-version: '21'
@@ -44,8 +44,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'adopt-hotspot' distribution: 'adopt-hotspot'
java-version: '11' java-version: '11'
@@ -56,8 +56,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'zulu' distribution: 'zulu'
java-version: '21' java-version: '21'
@@ -69,8 +69,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'liberica' distribution: 'liberica'
java-version: '21' java-version: '21'
@@ -82,8 +82,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'microsoft' distribution: 'microsoft'
java-version: '21' java-version: '21'
@@ -97,7 +97,7 @@ steps:
To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action: To get a higher rate limit, you can [generate a personal access token on github.com](https://github.com/settings/tokens/new) and pass it as the `token` input for the action:
```yaml ```yaml
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
token: ${{ secrets.GH_DOTCOM_TOKEN }} token: ${{ secrets.GH_DOTCOM_TOKEN }}
distribution: 'microsoft' distribution: 'microsoft'
@@ -111,8 +111,8 @@ If the runner is not able to access github.com, any Java versions requested duri
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'corretto' distribution: 'corretto'
java-version: '21' java-version: '21'
@@ -124,8 +124,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'oracle' distribution: 'oracle'
java-version: '21' java-version: '21'
@@ -137,8 +137,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'dragonwell' distribution: 'dragonwell'
java-version: '8' java-version: '8'
@@ -149,8 +149,8 @@ steps:
**NOTE:** An OpenJDK release maintained and supported by SAP **NOTE:** An OpenJDK release maintained and supported by SAP
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'sapmachine' distribution: 'sapmachine'
java-version: '21' java-version: '21'
@@ -162,8 +162,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'graalvm' distribution: 'graalvm'
java-version: '21' java-version: '21'
@@ -181,8 +181,8 @@ For example, `11.0.24` is not available but `11.0.16` is.
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jetbrains' distribution: 'jetbrains'
java-version: '11' java-version: '11'
@@ -194,8 +194,8 @@ GitHub token to the action to increase the rate limit. Set the `GITHUB_TOKEN` en
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jetbrains' distribution: 'jetbrains'
java-version: '17' java-version: '17'
@@ -219,8 +219,8 @@ The available package types are:
## Installing custom Java package type ## Installing custom Java package type
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -232,8 +232,8 @@ steps:
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -249,7 +249,7 @@ steps:
- run: | - run: |
download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz" download_url="https://github.com/AdoptOpenJDK/openjdk11-binaries/releases/download/jdk-11.0.10%2B9/OpenJDK11U-jdk_x64_linux_hotspot_11.0.10_9.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -275,7 +275,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver') latest_semver_version=$(curl -sL $latest_jdk_json_url | jq -r 'version.semver')
echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT" echo "java_version=$latest_semver_version" >> "$GITHUB_OUTPUT"
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -296,9 +296,9 @@ jobs:
java: [ '8', '11' ] java: [ '8', '11' ]
name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample name: Java ${{ matrix.Java }} (${{ matrix.distribution }}) sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: ${{ matrix.distribution }} distribution: ${{ matrix.distribution }}
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@@ -316,9 +316,9 @@ jobs:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ] os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample name: Java ${{ matrix.Java }} (${{ matrix.os }}) sample
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Setup java - name: Setup java
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: ${{ matrix.java }} java-version: ${{ matrix.java }}
@@ -333,9 +333,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -349,7 +349,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password GITHUB_TOKEN: ${{ github.token }} # GITHUB_TOKEN is the default env for the password
- name: Set up Apache Maven Central - name: Set up Apache Maven Central
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: # running setup-java again overwrites the settings.xml with: # running setup-java again overwrites the settings.xml
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@@ -446,9 +446,9 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up JDK 11 for Shared Runner - name: Set up JDK 11 for Shared Runner
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -472,10 +472,10 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- name: Set up JDK 11 - name: Set up JDK 11
uses: actions/setup-java@v4 uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '11' java-version: '11'
@@ -509,14 +509,14 @@ Subsequent calls to `setup-java` with distinct distribution and version paramete
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
8 8
11 11
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: '15' java-version: '15'
@@ -528,7 +528,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -545,7 +545,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
- run: | - run: |
download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz" download_url="https://example.com/java/jdk/6u45-b06/jdk-6u45-linux-x64.tar.gz"
wget -O $RUNNER_TEMP/java_package.tar.gz $download_url wget -O $RUNNER_TEMP/java_package.tar.gz $download_url
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'jdkfile' distribution: 'jdkfile'
jdkFile: ${{ runner.temp }}/java_package.tar.gz jdkFile: ${{ runner.temp }}/java_package.tar.gz
@@ -560,7 +560,7 @@ In case you install multiple versions of Java at once with multi-line `java-vers
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@@ -574,8 +574,8 @@ Each JDK provider will receive a default `id` based on the combination of `distr
```yaml ```yaml
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v5
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: 'temurin' distribution: 'temurin'
java-version: '11' java-version: '11'
@@ -587,7 +587,7 @@ In case you install multiple versions of Java at once you can use the same synta
```yaml ```yaml
steps: steps:
- uses: actions/setup-java@v4 - uses: actions/setup-java@v5
with: with:
distribution: '<distribution>' distribution: '<distribution>'
java-version: | java-version: |
@@ -614,5 +614,9 @@ major versions: 8, 11, 16, 17, 21
more specific versions: 8.0.282+8, 8.0.232, 11.0, 11.0.4, 17.0 more specific versions: 8.0.282+8, 8.0.232, 11.0, 11.0.4, 17.0
early access (EA) versions: 15-ea, 15.0.0-ea early access (EA) versions: 15-ea, 15.0.0-ea
versions with specified distribution: openjdk64-11.0.2 versions with specified distribution: openjdk64-11.0.2
LTS versions : temurin-21.0.5+11.0.LTS
``` ```
If the file contains multiple versions, only the first one will be recognized. If the file contains multiple versions, only the first one will be recognized.
***NOTE***:
For the tool-version file, ensure that you use standard semantic versioning (semver) formats, as non-standard formats (such as jetbrains-21b212.1) may not be parsed correctly. Additionally, for complex version strings containing multiple version-like segments (for example, java semeru-openj9-11.0.15+10_openj9-0.32.0), the extraction logic may incorrectly capture the last segment (0.32.0) instead of the main version (11.0.15+10).

915
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,12 @@
{ {
"name": "setup-java", "name": "setup-java",
"version": "4.0.0", "version": "5.0.0",
"private": true, "private": true,
"description": "setup java action", "description": "setup java action",
"main": "dist/setup/index.js", "main": "dist/setup/index.js",
"engines": {
"node": ">=24.0.0"
},
"scripts": { "scripts": {
"build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts", "build": "ncc build -o dist/setup src/setup-java.ts && ncc build -o dist/cleanup src/cleanup-java.ts",
"format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"", "format": "prettier --no-error-on-unmatched-pattern --config ./.prettierrc.js --write \"**/*.{ts,yml,yaml}\"",
@@ -38,18 +41,18 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^29.5.14", "@types/jest": "^29.5.14",
"@types/node": "^20.11.24", "@types/node": "^24.1.0",
"@types/semver": "^7.5.8", "@types/semver": "^7.5.8",
"@typescript-eslint/eslint-plugin": "^5.54.0", "@typescript-eslint/eslint-plugin": "^8.35.1",
"@typescript-eslint/parser": "^5.54.0", "@typescript-eslint/parser": "^8.35.1",
"@vercel/ncc": "^0.38.1", "@vercel/ncc": "^0.38.1",
"eslint": "^8.57.0", "eslint": "^9.39.1",
"eslint-config-prettier": "^8.6.0", "eslint-config-prettier": "^8.6.0",
"eslint-plugin-jest": "^27.9.0", "eslint-plugin-jest": "^29.0.1",
"eslint-plugin-node": "^11.1.0", "eslint-plugin-node": "^11.1.0",
"jest": "^29.7.0", "jest": "^29.7.0",
"jest-circus": "^29.7.0", "jest-circus": "^29.7.0",
"prettier": "^2.8.4", "prettier": "^3.6.2",
"ts-jest": "^29.3.0", "ts-jest": "^29.3.0",
"typescript": "^5.3.3" "typescript": "^5.3.3"
}, },
@@ -57,4 +60,4 @@
"url": "https://github.com/actions/setup-java/issues" "url": "https://github.com/actions/setup-java/issues"
}, },
"homepage": "https://github.com/actions/setup-java#readme" "homepage": "https://github.com/actions/setup-java#readme"
} }

View File

@@ -51,17 +51,115 @@ export abstract class JavaBase {
core.info(`Resolved Java ${foundJava.version} from tool-cache`); core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else { } else {
core.info('Trying to resolve the latest version from remote'); core.info('Trying to resolve the latest version from remote');
const javaRelease = await this.findPackageForDownload(this.version); const MAX_RETRIES = 4;
core.info(`Resolved latest version as ${javaRelease.version}`); const RETRY_DELAY_MS = 2000;
if (foundJava?.version === javaRelease.version) { const retryableCodes = [
core.info(`Resolved Java ${foundJava.version} from tool-cache`); 'ETIMEDOUT',
} else { 'ECONNRESET',
core.info('Trying to download...'); 'ENOTFOUND',
foundJava = await this.downloadTool(javaRelease); 'ECONNREFUSED'
core.info(`Java ${foundJava.version} was downloaded`); ];
let retries = MAX_RETRIES;
while (retries > 0) {
try {
// Clear console timers before each attempt to prevent conflicts
if (retries < MAX_RETRIES && core.isDebug()) {
const consoleAny = console as any;
consoleAny._times?.clear?.();
}
const javaRelease = await this.findPackageForDownload(this.version);
core.info(`Resolved latest version as ${javaRelease.version}`);
if (foundJava?.version === javaRelease.version) {
core.info(`Resolved Java ${foundJava.version} from tool-cache`);
} else {
core.info('Trying to download...');
foundJava = await this.downloadTool(javaRelease);
core.info(`Java ${foundJava.version} was downloaded`);
}
break;
} catch (error: any) {
retries--;
// Check if error is retryable (including aggregate errors)
const isRetryable =
(error instanceof tc.HTTPError &&
error.httpStatusCode &&
[429, 502, 503, 504].includes(error.httpStatusCode)) ||
retryableCodes.includes(error?.code) ||
(error?.errors &&
Array.isArray(error.errors) &&
error.errors.some((err: any) =>
retryableCodes.includes(err?.code)
));
if (retries > 0 && isRetryable) {
core.debug(
`Attempt failed due to network or timeout issues, initiating retry... (${retries} attempts left)`
);
await new Promise(r => setTimeout(r, RETRY_DELAY_MS));
continue;
}
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 if (error && error.errors && Array.isArray(error.errors)) {
core.error(
`Java setup failed due to network or configuration error(s)`
);
if (error instanceof Error && error.stack) {
core.debug(error.stack);
}
for (const err of error.errors) {
const endpoint = err?.address || err?.hostname || '';
const port = err?.port ? `:${err.port}` : '';
const message = err?.message || 'Aggregate error';
const endpointInfo = !message.includes(endpoint)
? ` ${endpoint}${port}`
: '';
const localInfo =
err.localAddress && err.localPort
? ` - Local (${err.localAddress}:${err.localPort})`
: '';
const logMessage = `${message}${endpointInfo}${localInfo}`;
core.error(logMessage);
core.debug(`${err.stack || err.message}`);
Object.entries(err).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
} else {
const message =
error instanceof Error ? error.message : JSON.stringify(error);
core.error(`Java setup process failed due to: ${message}`);
if (typeof error?.code === 'string') {
core.debug(error.stack);
}
const errorDetails = {
name: error.name,
message: error.message,
...Object.getOwnPropertyNames(error)
.filter(prop => !['name', 'message', 'stack'].includes(prop))
.reduce<{[key: string]: any}>((acc, prop) => {
acc[prop] = error[prop];
return acc;
}, {})
};
Object.entries(errorDetails).forEach(([key, value]) => {
core.debug(`"${key}": ${JSON.stringify(value)}`);
});
}
throw error;
}
} }
} }
if (!foundJava) {
throw new Error('Failed to resolve Java version');
}
// JDK folder may contain postfix "Contents/Home" on macOS // JDK folder may contain postfix "Contents/Home" on macOS
const macOSPostfixPath = path.join( const macOSPostfixPath = path.join(
foundJava.path, foundJava.path,

View File

@@ -1,10 +1,10 @@
import * as core from '@actions/core'; import * as core from '@actions/core';
import * as tc from '@actions/tool-cache'; import * as tc from '@actions/tool-cache';
import fs from 'fs'; import fs from 'fs';
import path from 'path'; import path from 'path';
import {JavaBase} from '../base-installer'; import {JavaBase} from '../base-installer';
import {HttpCodes} from '@actions/http-client';
import {GraalVMEAVersion} from './models';
import { import {
JavaDownloadRelease, JavaDownloadRelease,
JavaInstallerOptions, JavaInstallerOptions,
@@ -16,12 +16,14 @@ import {
getGitHubHttpHeaders, getGitHubHttpHeaders,
renameWinArchive renameWinArchive
} from '../../util'; } from '../../util';
import {HttpCodes} from '@actions/http-client';
import {GraalVMEAVersion} from './models';
const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm'; const GRAALVM_DL_BASE = 'https://download.oracle.com/graalvm';
const IS_WINDOWS = process.platform === 'win32'; const IS_WINDOWS = process.platform === 'win32';
const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform; const GRAALVM_PLATFORM = IS_WINDOWS ? 'windows' : process.platform;
const GRAALVM_MIN_VERSION = 17;
const SUPPORTED_ARCHITECTURES = ['x64', 'aarch64'] as const;
type SupportedArchitecture = (typeof SUPPORTED_ARCHITECTURES)[number];
type OsVersions = 'linux' | 'macos' | 'windows';
export class GraalVMDistribution extends JavaBase { export class GraalVMDistribution extends JavaBase {
constructor(installerOptions: JavaInstallerOptions) { constructor(installerOptions: JavaInstallerOptions) {
@@ -31,38 +33,67 @@ export class GraalVMDistribution extends JavaBase {
protected async downloadTool( protected async downloadTool(
javaRelease: JavaDownloadRelease javaRelease: JavaDownloadRelease
): Promise<JavaInstallerResults> { ): Promise<JavaInstallerResults> {
core.info( try {
`Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...` core.info(
); `Downloading Java ${javaRelease.version} (${this.distribution}) from ${javaRelease.url} ...`
let javaArchivePath = await tc.downloadTool(javaRelease.url); );
let javaArchivePath = await tc.downloadTool(javaRelease.url);
core.info(`Extracting Java archive...`); core.info(`Extracting Java archive...`);
const extension = getDownloadArchiveExtension(); const extension = getDownloadArchiveExtension();
if (process.platform === 'win32') { if (IS_WINDOWS) {
javaArchivePath = renameWinArchive(javaArchivePath); javaArchivePath = renameWinArchive(javaArchivePath);
}
const extractedJavaPath = await extractJdkFile(
javaArchivePath,
extension
);
// Add validation for extracted path
if (!fs.existsSync(extractedJavaPath)) {
throw new Error(
`Extraction failed: path ${extractedJavaPath} does not exist`
);
}
const dirContents = fs.readdirSync(extractedJavaPath);
if (dirContents.length === 0) {
throw new Error(
'Extraction failed: no files found in extracted directory'
);
}
const archivePath = path.join(extractedJavaPath, dirContents[0]);
const version = this.getToolcacheVersionName(javaRelease.version);
const javaPath = await tc.cacheDir(
archivePath,
this.toolcacheFolderName,
version,
this.architecture
);
return {version: javaRelease.version, path: javaPath};
} catch (error) {
core.error(`Failed to download and extract GraalVM: ${error}`);
throw error;
} }
const extractedJavaPath = await extractJdkFile(javaArchivePath, extension);
const archiveName = fs.readdirSync(extractedJavaPath)[0];
const archivePath = path.join(extractedJavaPath, archiveName);
const version = this.getToolcacheVersionName(javaRelease.version);
const javaPath = await tc.cacheDir(
archivePath,
this.toolcacheFolderName,
version,
this.architecture
);
return {version: javaRelease.version, path: javaPath};
} }
protected async findPackageForDownload( protected async findPackageForDownload(
range: string range: string
): Promise<JavaDownloadRelease> { ): Promise<JavaDownloadRelease> {
// Add input validation
if (!range || typeof range !== 'string') {
throw new Error('Version range is required and must be a string');
}
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
if (arch !== 'x64' && arch !== 'aarch64') { if (!SUPPORTED_ARCHITECTURES.includes(arch as SupportedArchitecture)) {
throw new Error(`Unsupported architecture: ${this.architecture}`); throw new Error(
`Unsupported architecture: ${this.architecture}. Supported architectures are: ${SUPPORTED_ARCHITECTURES.join(', ')}`
);
} }
if (!this.stable) { if (!this.stable) {
@@ -75,52 +106,113 @@ export class GraalVMDistribution extends JavaBase {
const platform = this.getPlatform(); const platform = this.getPlatform();
const extension = getDownloadArchiveExtension(); const extension = getDownloadArchiveExtension();
let major; const major = range.includes('.') ? range.split('.')[0] : range;
let fileUrl; const majorVersion = parseInt(major);
if (range.includes('.')) {
major = range.split('.')[0]; if (isNaN(majorVersion)) {
fileUrl = `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`; throw new Error(`Invalid version format: ${range}`);
} else {
major = range;
fileUrl = `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
} }
if (parseInt(major) < 17) { if (majorVersion < GRAALVM_MIN_VERSION) {
throw new Error('GraalVM is only supported for JDK 17 and later');
}
const response = await this.http.head(fileUrl);
if (response.message.statusCode === HttpCodes.NotFound) {
throw new Error(`Could not find GraalVM for SemVer ${range}`);
}
if (response.message.statusCode !== HttpCodes.OK) {
throw new Error( throw new Error(
`Http request for GraalVM failed with status code: ${response.message.statusCode}` `GraalVM is only supported for JDK ${GRAALVM_MIN_VERSION} and later. Requested version: ${major}`
); );
} }
const fileUrl = this.constructFileUrl(
range,
major,
platform,
arch,
extension
);
const response = await this.http.head(fileUrl);
this.handleHttpResponse(response, range);
return {url: fileUrl, version: range}; return {url: fileUrl, version: range};
} }
private constructFileUrl(
range: string,
major: string,
platform: string,
arch: string,
extension: string
): string {
return range.includes('.')
? `${GRAALVM_DL_BASE}/${major}/archive/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`
: `${GRAALVM_DL_BASE}/${range}/latest/graalvm-jdk-${range}_${platform}-${arch}_bin.${extension}`;
}
private handleHttpResponse(response: any, range: string): void {
const statusCode = response.message.statusCode;
if (statusCode === HttpCodes.NotFound) {
throw new Error(
`Could not find GraalVM for SemVer ${range}. Please check if this version is available at ${GRAALVM_DL_BASE}`
);
}
if (
statusCode === HttpCodes.Unauthorized ||
statusCode === HttpCodes.Forbidden
) {
throw new Error(
`Access denied when downloading GraalVM. Status code: ${statusCode}. Please check your credentials or permissions.`
);
}
if (statusCode !== HttpCodes.OK) {
throw new Error(
`HTTP request for GraalVM failed with status code: ${statusCode} (${response.message.statusMessage || 'Unknown error'})`
);
}
}
private async findEABuildDownloadUrl( private async findEABuildDownloadUrl(
javaEaVersion: string javaEaVersion: string
): Promise<JavaDownloadRelease> { ): Promise<JavaDownloadRelease> {
core.debug(`Searching for EA build: ${javaEaVersion}`);
const versions = await this.fetchEAJson(javaEaVersion); const versions = await this.fetchEAJson(javaEaVersion);
core.debug(`Found ${versions.length} EA versions`);
const latestVersion = versions.find(v => v.latest); const latestVersion = versions.find(v => v.latest);
if (!latestVersion) { if (!latestVersion) {
core.error(
`Available versions: ${versions.map(v => v.version).join(', ')}`
);
throw new Error(`Unable to find latest version for '${javaEaVersion}'`); throw new Error(`Unable to find latest version for '${javaEaVersion}'`);
} }
core.debug(`Latest version found: ${latestVersion.version}`);
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
const file = latestVersion.files.find( const file = latestVersion.files.find(
f => f.arch === arch && f.platform === GRAALVM_PLATFORM f => f.arch === arch && f.platform === GRAALVM_PLATFORM
); );
if (!file || !file.filename.startsWith('graalvm-jdk-')) {
throw new Error(`Unable to find file metadata for '${javaEaVersion}'`); if (!file) {
core.error(
`Available files for architecture ${arch}: ${JSON.stringify(latestVersion.files)}`
);
throw new Error(
`Unable to find file for architecture '${arch}' and platform '${GRAALVM_PLATFORM}'`
);
} }
if (!file.filename.startsWith('graalvm-jdk-')) {
throw new Error(
`Invalid filename format: ${file.filename}. Expected to start with 'graalvm-jdk-'`
);
}
const downloadUrl = `${latestVersion.download_base_url}${file.filename}`;
core.debug(`Download URL: ${downloadUrl}`);
return { return {
url: `${latestVersion.download_base_url}${file.filename}`, url: downloadUrl,
version: latestVersion.version version: latestVersion.version
}; };
} }
@@ -128,49 +220,59 @@ export class GraalVMDistribution extends JavaBase {
private async fetchEAJson( private async fetchEAJson(
javaEaVersion: string javaEaVersion: string
): Promise<GraalVMEAVersion[]> { ): Promise<GraalVMEAVersion[]> {
const owner = 'graalvm'; const url = `https://api.github.com/repos/graalvm/oracle-graalvm-ea-builds/contents/versions/${javaEaVersion}.json?ref=main`;
const repository = 'oracle-graalvm-ea-builds';
const branch = 'main';
const filePath = `versions/${javaEaVersion}.json`;
const url = `https://api.github.com/repos/${owner}/${repository}/contents/${filePath}?ref=${branch}`;
const headers = getGitHubHttpHeaders(); const headers = getGitHubHttpHeaders();
core.debug( core.debug(
`Trying to fetch available version info for GraalVM EA builds from '${url}'` `Trying to fetch available version info for GraalVM EA builds from '${url}'`
); );
let fetchedJson;
try { try {
fetchedJson = (await this.http.getJson<GraalVMEAVersion[]>(url, headers)) const response = await this.http.getJson<GraalVMEAVersion[]>(
.result; url,
} catch (err) { headers
throw Error( );
`Fetching version info for GraalVM EA builds from '${url}' failed with the error: ${
(err as Error).message if (!response.result) {
}` throw new Error(
`No GraalVM EA build found for version '${javaEaVersion}'. Please check if the version is correct.`
);
}
return response.result;
} catch (error) {
if (error instanceof Error) {
// Check if it's a 404 error (file not found)
if (error.message?.includes('404')) {
throw new Error(
`GraalVM EA version '${javaEaVersion}' not found. Please verify the version exists in the EA builds repository.`
);
}
// Re-throw with more context
throw new Error(
`Failed to fetch GraalVM EA version information for '${javaEaVersion}': ${error.message}`
);
}
// If it's not an Error instance, throw a generic error
throw new Error(
`Failed to fetch GraalVM EA version information for '${javaEaVersion}'`
); );
} }
if (fetchedJson === null) {
throw Error(
`No GraalVM EA build found. Are you sure java-version: '${javaEaVersion}' is correct?`
);
}
return fetchedJson;
} }
public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions { public getPlatform(platform: NodeJS.Platform = process.platform): OsVersions {
switch (platform) { const platformMap: Record<string, OsVersions> = {
case 'darwin': darwin: 'macos',
return 'macos'; win32: 'windows',
case 'win32': linux: 'linux'
return 'windows'; };
case 'linux':
return 'linux'; const result = platformMap[platform];
default: if (!result) {
throw new Error( throw new Error(
`Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'` `Platform '${platform}' is not supported. Supported platforms: 'linux', 'macos', 'windows'`
); );
} }
return result;
} }
} }

View File

@@ -113,9 +113,18 @@ export class JetBrainsDistribution extends JavaBase {
core.debug(`Gathering available versions from '${rawUrl}'`); core.debug(`Gathering available versions from '${rawUrl}'`);
} }
const paginationPage = ( const paginationPageResult = (
await this.http.getJson<IJetBrainsRawVersion[]>(rawUrl, requestHeaders) await this.http.getJson<IJetBrainsRawVersion[]>(rawUrl, requestHeaders)
).result; ).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) { if (!paginationPage || paginationPage.length === 0) {
// break infinity loop because we have reached end of pagination // break infinity loop because we have reached end of pagination
break; break;
@@ -125,9 +134,13 @@ export class JetBrainsDistribution extends JavaBase {
page_index++; page_index++;
} }
// Add versions not available from the API but are downloadable if (this.stable) {
const hidden = ['11_0_10b1145.115', '11_0_11b1341.60']; // Add versions not available from the API but are downloadable
rawVersions.push(...hidden.map(tag => ({tag_name: tag, name: tag}))); const hidden = ['11_0_10b1145.115', '11_0_11b1341.60'];
rawVersions.push(
...hidden.map(tag => ({tag_name: tag, name: tag, prerelease: false}))
);
}
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:
@@ -148,7 +161,7 @@ export class JetBrainsDistribution extends JavaBase {
const vsplit = vstring.split('b'); const vsplit = vstring.split('b');
let semver = vsplit[0]; let semver = vsplit[0];
const build = +vsplit[1]; const build = vsplit[1];
// Normalize semver // Normalize semver
if (!semver.includes('.') && !semver.includes('_')) if (!semver.includes('.') && !semver.includes('_'))

View File

@@ -3,11 +3,12 @@
export interface IJetBrainsRawVersion { export interface IJetBrainsRawVersion {
tag_name: string; tag_name: string;
name: string; name: string;
prerelease: boolean;
} }
export interface IJetBrainsVersion { export interface IJetBrainsVersion {
tag_name: string; tag_name: string;
semver: string; semver: string;
build: number; build: string;
url: string; url: string;
} }

View File

@@ -116,7 +116,7 @@ export class MicrosoftDistributions extends JavaBase {
} }
} catch (err) { } catch (err) {
core.debug( core.debug(
`Http request for microsoft-openjdk-versions.json failed with status code: ${response?.statusCode}` `Http request for microsoft-openjdk-versions.json failed with status code: ${response?.statusCode}. Error: ${err}`
); );
return null; return null;
} }

View File

@@ -1,90 +1,133 @@
[ [
{ {
"version": "21.0.2", "version": "25.0.0",
"stable": true, "stable": true,
"release_url": "https://aka.ms/download-jdk", "release_url": "https://aka.ms/download-jdk",
"files": [ "files": [
{ {
"filename": "microsoft-jdk-21.0.2-macos-x64.tar.gz", "filename": "microsoft-jdk-25.0.0-macos-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-linux-x64.tar.gz", "filename": "microsoft-jdk-25.0.0-linux-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-windows-x64.zip", "filename": "microsoft-jdk-25.0.0-windows-x64.zip",
"arch": "x64", "arch": "x64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-x64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-x64.zip"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-macos-aarch64.tar.gz", "filename": "microsoft-jdk-25.0.0-macos-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-macos-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-linux-aarch64.tar.gz", "filename": "microsoft-jdk-25.0.0-linux-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-linux-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.2-windows-aarch64.zip", "filename": "microsoft-jdk-25.0.0-windows-aarch64.zip",
"arch": "aarch64", "arch": "aarch64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-aarch64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-25.0.0-windows-aarch64.zip"
} }
] ]
}, },
{ {
"version": "21.0.1", "version": "21.0.2",
"stable": true, "stable": true,
"release_url": "https://aka.ms/download-jdk", "release_url": "https://aka.ms/download-jdk",
"files": [ "files": [
{ {
"filename": "microsoft-jdk-21.0.1-macos-x64.tar.gz", "filename": "microsoft-jdk-21.0.2-macos-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-linux-x64.tar.gz", "filename": "microsoft-jdk-21.0.2-linux-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-windows-x64.zip", "filename": "microsoft-jdk-21.0.2-windows-x64.zip",
"arch": "x64", "arch": "x64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-x64.zip"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-macos-aarch64.tar.gz", "filename": "microsoft-jdk-21.0.2-macos-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-macos-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-linux-aarch64.tar.gz", "filename": "microsoft-jdk-21.0.2-linux-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-linux-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-21.0.1-windows-aarch64.zip", "filename": "microsoft-jdk-21.0.2-windows-aarch64.zip",
"arch": "aarch64", "arch": "aarch64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-aarch64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.2-windows-aarch64.zip"
} }
] ]
}, },
{
"version": "21.0.1",
"stable": true,
"release_url": "https://aka.ms/download-jdk",
"files": [
{
"filename": "microsoft-jdk-21.0.1-macos-x64.tar.gz",
"arch": "x64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-x64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-linux-x64.tar.gz",
"arch": "x64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-x64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-windows-x64.zip",
"arch": "x64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-x64.zip"
},
{
"filename": "microsoft-jdk-21.0.1-macos-aarch64.tar.gz",
"arch": "aarch64",
"platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-macos-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-linux-aarch64.tar.gz",
"arch": "aarch64",
"platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-linux-aarch64.tar.gz"
},
{
"filename": "microsoft-jdk-21.0.1-windows-aarch64.zip",
"arch": "aarch64",
"platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-21.0.1-windows-aarch64.zip"
}
]
},
{ {
"version": "21.0.0", "version": "21.0.0",
"stable": true, "stable": true,
@@ -176,42 +219,42 @@
"stable": true, "stable": true,
"release_url": "https://aka.ms/download-jdk", "release_url": "https://aka.ms/download-jdk",
"files": [ "files": [
{ {
"filename": "microsoft-jdk-17.0.9-macos-x64.tar.gz", "filename": "microsoft-jdk-17.0.9-macos-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-linux-x64.tar.gz", "filename": "microsoft-jdk-17.0.9-linux-x64.tar.gz",
"arch": "x64", "arch": "x64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-x64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-windows-x64.zip", "filename": "microsoft-jdk-17.0.9-windows-x64.zip",
"arch": "x64", "arch": "x64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-x64.zip"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-macos-aarch64.tar.gz", "filename": "microsoft-jdk-17.0.9-macos-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "darwin", "platform": "darwin",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-macos-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-linux-aarch64.tar.gz", "filename": "microsoft-jdk-17.0.9-linux-aarch64.tar.gz",
"arch": "aarch64", "arch": "aarch64",
"platform": "linux", "platform": "linux",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-aarch64.tar.gz" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-linux-aarch64.tar.gz"
}, },
{ {
"filename": "microsoft-jdk-17.0.9-windows-aarch64.zip", "filename": "microsoft-jdk-17.0.9-windows-aarch64.zip",
"arch": "aarch64", "arch": "aarch64",
"platform": "win32", "platform": "win32",
"download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-aarch64.zip" "download_url": "https://aka.ms/download-jdk/microsoft-jdk-17.0.9-windows-aarch64.zip"
} }
] ]
}, },
{ {
@@ -835,4 +878,4 @@
} }
] ]
} }
] ]

View File

@@ -8,7 +8,6 @@ import {
convertVersionToSemver, convertVersionToSemver,
extractJdkFile, extractJdkFile,
getDownloadArchiveExtension, getDownloadArchiveExtension,
getGitHubHttpHeaders,
isVersionSatisfies, isVersionSatisfies,
renameWinArchive renameWinArchive
} from '../../util'; } from '../../util';
@@ -64,13 +63,12 @@ export class SapMachineDistribution extends JavaBase {
const arch = this.distributionArchitecture(); const arch = this.distributionArchitecture();
let fetchedReleasesJson = await this.fetchReleasesFromUrl( let fetchedReleasesJson = await this.fetchReleasesFromUrl(
'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json' 'https://sapmachine.io/assets/data/sapmachine-releases-all.json'
); );
if (!fetchedReleasesJson) { if (!fetchedReleasesJson) {
fetchedReleasesJson = await this.fetchReleasesFromUrl( fetchedReleasesJson = await this.fetchReleasesFromUrl(
'https://api.github.com/repos/SAP/SapMachine/contents/assets/data/sapmachine-releases-all.json?ref=gh-pages', 'https://sap.github.io/SapMachine/assets/data/sapmachine-releases-all.json'
getGitHubHttpHeaders()
); );
} }

View File

@@ -59,9 +59,8 @@ export async function createToolchainsSettings({
// when an alternate m2 location is specified use only that location (no .m2 directory) // when an alternate m2 location is specified use only that location (no .m2 directory)
// otherwise use the home/.m2/ path // otherwise use the home/.m2/ path
await io.mkdirP(settingsDirectory); await io.mkdirP(settingsDirectory);
const originalToolchains = await readExistingToolchainsFile( const originalToolchains =
settingsDirectory await readExistingToolchainsFile(settingsDirectory);
);
const updatedToolchains = generateToolchainDefinition( const updatedToolchains = generateToolchainDefinition(
originalToolchains, originalToolchains,
jdkInfo.version, jdkInfo.version,

View File

@@ -133,7 +133,7 @@ export function getVersionFromFileContent(
const versionFileName = getFileName(versionFile); const versionFileName = getFileName(versionFile);
if (versionFileName == '.tool-versions') { if (versionFileName == '.tool-versions') {
javaVersionRegExp = javaVersionRegExp =
/^(java\s+)(?:\S*-)?v?(?<version>(\d+)(\.\d+)?(\.\d+)?(\+\d+)?(-ea(\.\d+)?)?)$/m; /^java\s+(?:\S*-)?(?<version>\d+(?:\.\d+)*([+_.-](?:openj9[-._]?\d[\w.-]*|java\d+|jre[-_\w]*|OpenJDK\d+[\w_.-]*|[a-z0-9]+))*)/im;
} else { } else {
javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/; javaVersionRegExp = /(?<version>(?<=(^|\s|-))(\d+\S*))(\s|$)/;
} }
@@ -184,8 +184,8 @@ export function convertVersionToSemver(version: number[] | string) {
} }
export function getGitHubHttpHeaders(): OutgoingHttpHeaders { export function getGitHubHttpHeaders(): OutgoingHttpHeaders {
const token = core.getInput('token'); const resolvedToken = core.getInput('token') || process.env.GITHUB_TOKEN;
const auth = !token ? undefined : `token ${token}`; const auth = !resolvedToken ? undefined : `token ${resolvedToken}`;
const headers: OutgoingHttpHeaders = { const headers: OutgoingHttpHeaders = {
accept: 'application/vnd.github.VERSION.raw' accept: 'application/vnd.github.VERSION.raw'