GeezerVison is showing github.com — Rename jdkFile input to jdk-file with deprecated alias (#1083) · actions/setup-java@f45cd82
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: .github/workflows/e2e-local-file.yml +3-2Lines changed: 3 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 47 | 47 | id: setup-java | 48 | 48 | with: | 49 | 49 | distribution: 'jdkfile' | 50 | | - jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }} | | 50 | + jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }} | 51 | 51 | java-version: '11.0.0-ea' | 52 | 52 | architecture: x64 | 53 | 53 | - name: Verify Java version | | 88 | 88 | id: setup-java | 89 | 89 | with: | 90 | 90 | distribution: 'jdkfile' | 91 | | - jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }} | | 91 | + jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }} | 92 | 92 | java-version: '11.0.0-ea' | 93 | 93 | architecture: x64 | 94 | 94 | - name: Verify Java version | @@ -129,6 +129,7 @@ jobs: | 129 | 129 | id: setup-java | 130 | 130 | with: | 131 | 131 | distribution: 'jdkfile' | | 132 | + # Intentionally uses the deprecated `jdkFile` alias to keep it covered. | 132 | 133 | jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }} | 133 | 134 | java-version: '11.0.0-ea' | 134 | 135 | architecture: x64 | |
Collapse file Copy file name to clipboardExpand all lines: README.md +1-1Lines changed: 1 addition & 1 deletion - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -37,7 +37,7 @@ For more details, see the full release notes on the [releases page](https://git | 37 | 37 |
| 38 | 38 | - `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine. | 39 | 39 |
| 40 | | - - `jdkFile`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM. Note: `distribution` must be set to 'jdkfile' (case-sensitive; all lowercase) when using this option. | | 40 | + - `jdk-file`: If a use-case requires a custom distribution setup-java uses the compressed JDK from the location pointed by this input and will take care of the installation and caching on the VM. Note: `distribution` must be set to 'jdkfile' (case-sensitive; all lowercase) when using this option. (The camelCase `jdkFile` input is still accepted as a deprecated alias and may be removed in a future release.) | 41 | 41 |
| 42 | 42 | - `check-latest`: Setting this option makes the action to check for the latest available version for the version spec. | 43 | 43 |
| |
Collapse file Copy file name to clipboardExpand all lines: action.yml +5-1Lines changed: 5 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,9 +19,13 @@ inputs: | 19 | 19 | architecture: | 20 | 20 | description: "The architecture of the package (defaults to the action runner's architecture)" | 21 | 21 | required: false | 22 | | - jdkFile: | | 22 | + jdk-file: | 23 | 23 | description: 'Path to where the compressed JDK is located' | 24 | 24 | required: false | | 25 | + jdkFile: | | 26 | + description: 'Deprecated alias for `jdk-file`. Path to where the compressed JDK is located. Use `jdk-file` instead; this alias may be removed in a future release.' | | 27 | + required: false | | 28 | + deprecationMessage: 'The `jdkFile` input is deprecated. Use `jdk-file` instead.' | 25 | 29 | check-latest: | 26 | 30 | description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec' | 27 | 31 | required: false | |
Collapse file Copy file name to clipboardExpand all lines: docs/advanced-usage.md +6-6Lines changed: 6 additions & 6 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -330,7 +330,7 @@ In this example, `JAVA_HOME` and `java` on `PATH` point to Java 17, while Java 2 | 330 | 330 | If your use-case requires a custom distribution or a version that is not provided by setup-java, you can download it manually and setup-java will take care of the installation and caching on the VM: | 331 | 331 |
| 332 | 332 | > [!NOTE] | 333 | | -> This approach also lets you use builds that setup-java does not provide directly, such as **Early Access (EA)** or other unreleased JDK builds (for example, an upcoming feature release or a Loom/Valhalla preview build). Download the desired archive in a prior step and point `jdkFile` at it; setup-java will extract, install, and cache it just like a supported distribution. When targeting multiple architectures, select the correct binary per architecture in your workflow (for example, with a build matrix). | | 333 | +> This approach also lets you use builds that setup-java does not provide directly, such as **Early Access (EA)** or other unreleased JDK builds (for example, an upcoming feature release or a Loom/Valhalla preview build). Download the desired archive in a prior step and point `jdk-file` at it; setup-java will extract, install, and cache it just like a supported distribution. When targeting multiple architectures, select the correct binary per architecture in your workflow (for example, with a build matrix). | 334 | 334 |
| 335 | 335 | ```yaml | 336 | 336 | steps: | @@ -340,7 +340,7 @@ steps: | 340 | 340 | - uses: actions/setup-java@v5 | 341 | 341 | with: | 342 | 342 | distribution: 'jdkfile' | 343 | | - jdkFile: ${{ runner.temp }}/java_package.tar.gz | | 343 | + jdk-file: ${{ runner.temp }}/java_package.tar.gz | 344 | 344 | java-version: '11.0.0' | 345 | 345 | architecture: x64 | 346 | 346 | | @@ -357,7 +357,7 @@ steps: | 357 | 357 | - uses: actions/setup-java@v5 | 358 | 358 | with: | 359 | 359 | distribution: 'jdkfile' | 360 | | - jdkFile: ${{ runner.temp }}/java_package.tar.gz | | 360 | + jdk-file: ${{ runner.temp }}/java_package.tar.gz | 361 | 361 | java-version: '25.0.0-ea.36' | 362 | 362 | architecture: x64 | 363 | 363 |
| @@ -383,7 +383,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is | 383 | 383 | - uses: actions/setup-java@v5 | 384 | 384 | with: | 385 | 385 | distribution: 'jdkfile' | 386 | | - jdkFile: ${{ runner.temp }}/java_package.tar.gz | | 386 | + jdk-file: ${{ runner.temp }}/java_package.tar.gz | 387 | 387 | java-version: {{ steps.fetch_latest_jdk.outputs.java_version }} | 388 | 388 | architecture: x64 | 389 | 389 | - run: java --version | @@ -708,7 +708,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi | 708 | 708 | - uses: actions/setup-java@v5 | 709 | 709 | with: | 710 | 710 | distribution: 'jdkfile' | 711 | | - jdkFile: ${{ runner.temp }}/java_package.tar.gz | | 711 | + jdk-file: ${{ runner.temp }}/java_package.tar.gz | 712 | 712 | java-version: '1.6' | 713 | 713 | architecture: x64 | 714 | 714 | ``` | @@ -725,7 +725,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input | 725 | 725 | - uses: actions/setup-java@v5 | 726 | 726 | with: | 727 | 727 | distribution: 'jdkfile' | 728 | | - jdkFile: ${{ runner.temp }}/java_package.tar.gz | | 728 | + jdk-file: ${{ runner.temp }}/java_package.tar.gz | 729 | 729 | java-version: '1.6' | 730 | 730 | architecture: x64 | 731 | 731 | mvn-toolchain-vendor: 'Oracle' | |
Collapse file Copy file name to clipboardExpand all lines: src/constants.ts +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -4,7 +4,8 @@ export const INPUT_JAVA_VERSION_FILE = 'java-version-file'; | 4 | 4 | export const INPUT_ARCHITECTURE = 'architecture'; | 5 | 5 | export const INPUT_JAVA_PACKAGE = 'java-package'; | 6 | 6 | export const INPUT_DISTRIBUTION = 'distribution'; | 7 | | -export const INPUT_JDK_FILE = 'jdkFile'; | | 7 | +export const INPUT_JDK_FILE = 'jdk-file'; | | 8 | +export const INPUT_JDK_FILE_DEPRECATED = 'jdkFile'; | 8 | 9 | export const INPUT_CHECK_LATEST = 'check-latest'; | 9 | 10 | export const INPUT_SET_DEFAULT = 'set-default'; | 10 | 11 | export const INPUT_VERIFY_SIGNATURE = 'verify-signature'; | |
Collapse file Copy file name to clipboardExpand all lines: src/setup-java.ts +14-1Lines changed: 14 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -21,7 +21,7 @@ async function run() { | 21 | 21 | const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE); | 22 | 22 | const architecture = core.getInput(constants.INPUT_ARCHITECTURE); | 23 | 23 | const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE); | 24 | | - const jdkFile = core.getInput(constants.INPUT_JDK_FILE); | | 24 | + const jdkFile = getJdkFileInput(); | 25 | 25 | const cache = core.getInput(constants.INPUT_CACHE); | 26 | 26 | const cacheDependencyPath = core.getInput( | 27 | 27 | constants.INPUT_CACHE_DEPENDENCY_PATH | @@ -128,6 +128,19 @@ async function run() { | 128 | 128 |
| 129 | 129 | run(); | 130 | 130 |
| | 131 | +function getJdkFileInput(): string { | | 132 | + const jdkFile = core.getInput(constants.INPUT_JDK_FILE); | | 133 | + const deprecatedJdkFile = core.getInput(constants.INPUT_JDK_FILE_DEPRECATED); | | 134 | + | | 135 | + if (deprecatedJdkFile) { | | 136 | + core.warning( | | 137 | + `The '${constants.INPUT_JDK_FILE_DEPRECATED}' input is deprecated and may be removed in a future release. Please use '${constants.INPUT_JDK_FILE}' instead.` | | 138 | + ); | | 139 | + } | | 140 | + | | 141 | + return jdkFile || deprecatedJdkFile; | | 142 | +} | | 143 | + | 131 | 144 | async function installVersion( | 132 | 145 | version: string, | 133 | 146 | options: installerInputsOptions, | |
|