Skip to content

Commit f45cd82

Browse files
brunoborgesCopilot
andcommitted
Rename jdkFile input to jdk-file with deprecated alias (actions#1083)
* Rename jdkFile input to jdk-file with deprecated alias Add a standardized `jdk-file` input to match the lowercase-dash naming used by every other action input. The camelCase `jdkFile` input is kept as a deprecated alias: it still works, but emits a deprecation warning and may be removed in a future release. `jdk-file` takes precedence when both are provided. Updates docs and the local-file e2e workflow (one case intentionally keeps using the deprecated alias for coverage) and regenerates the dist bundles. Fixes actions#1077 Co-authored-by: Copilot App <[email protected]> * docs: keep jdkFile in switching-to-v2 guide The switching-to-v2 migration guide uses actions/setup-java@v2, which only supports the camelCase jdkFile input. Keep the new jdk-file spelling in current-version docs only. Co-authored-by: Copilot App <[email protected]> --------- Co-authored-by: Copilot App <[email protected]> (cherry picked from commit 7dbccc6)
1 parent e2863ad commit f45cd82

6 files changed

Lines changed: 31 additions & 12 deletions

File tree

‎.github/workflows/e2e-local-file.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
id: setup-java
4848
with:
4949
distribution: 'jdkfile'
50-
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
50+
jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }}
5151
java-version: '11.0.0-ea'
5252
architecture: x64
5353
- name: Verify Java version
@@ -88,7 +88,7 @@ jobs:
8888
id: setup-java
8989
with:
9090
distribution: 'jdkfile'
91-
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
91+
jdk-file: ${{ runner.temp }}/${{ env.LocalFilename }}
9292
java-version: '11.0.0-ea'
9393
architecture: x64
9494
- name: Verify Java version
@@ -129,6 +129,7 @@ jobs:
129129
id: setup-java
130130
with:
131131
distribution: 'jdkfile'
132+
# Intentionally uses the deprecated `jdkFile` alias to keep it covered.
132133
jdkFile: ${{ runner.temp }}/${{ env.LocalFilename }}
133134
java-version: '11.0.0-ea'
134135
architecture: x64

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ For more details, see the full release notes on the [releases page](https://git
3737

3838
- `architecture`: The target architecture of the package. Possible values: `x86`, `x64`, `armv7`, `aarch64`, `ppc64le`. Default value: Derived from the runner machine.
3939

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.)
4141

4242
- `check-latest`: Setting this option makes the action to check for the latest available version for the version spec.
4343

‎action.yml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,13 @@ inputs:
1919
architecture:
2020
description: "The architecture of the package (defaults to the action runner's architecture)"
2121
required: false
22-
jdkFile:
22+
jdk-file:
2323
description: 'Path to where the compressed JDK is located'
2424
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.'
2529
check-latest:
2630
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec'
2731
required: false

‎docs/advanced-usage.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ In this example, `JAVA_HOME` and `java` on `PATH` point to Java 17, while Java 2
330330
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:
331331

332332
> [!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).
334334

335335
```yaml
336336
steps:
@@ -340,7 +340,7 @@ steps:
340340
- uses: actions/setup-java@v5
341341
with:
342342
distribution: 'jdkfile'
343-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
343+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
344344
java-version: '11.0.0'
345345
architecture: x64
346346
@@ -357,7 +357,7 @@ steps:
357357
- uses: actions/setup-java@v5
358358
with:
359359
distribution: 'jdkfile'
360-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
360+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
361361
java-version: '25.0.0-ea.36'
362362
architecture: x64
363363

@@ -383,7 +383,7 @@ If your use-case requires a custom distribution (in the example, alpine-linux is
383383
- uses: actions/setup-java@v5
384384
with:
385385
distribution: 'jdkfile'
386-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
386+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
387387
java-version: {{ steps.fetch_latest_jdk.outputs.java_version }}
388388
architecture: x64
389389
- run: java --version
@@ -708,7 +708,7 @@ The result is a Toolchain with entries for JDKs 8, 11 and 15. You can even combi
708708
- uses: actions/setup-java@v5
709709
with:
710710
distribution: 'jdkfile'
711-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
711+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
712712
java-version: '1.6'
713713
architecture: x64
714714
```
@@ -725,7 +725,7 @@ Each JDK provider will receive a default `vendor` using the `distribution` input
725725
- uses: actions/setup-java@v5
726726
with:
727727
distribution: 'jdkfile'
728-
jdkFile: ${{ runner.temp }}/java_package.tar.gz
728+
jdk-file: ${{ runner.temp }}/java_package.tar.gz
729729
java-version: '1.6'
730730
architecture: x64
731731
mvn-toolchain-vendor: 'Oracle'

‎src/constants.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ export const INPUT_JAVA_VERSION_FILE = 'java-version-file';
44
export const INPUT_ARCHITECTURE = 'architecture';
55
export const INPUT_JAVA_PACKAGE = 'java-package';
66
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';
89
export const INPUT_CHECK_LATEST = 'check-latest';
910
export const INPUT_SET_DEFAULT = 'set-default';
1011
export const INPUT_VERIFY_SIGNATURE = 'verify-signature';

‎src/setup-java.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ async function run() {
2121
const versionFile = core.getInput(constants.INPUT_JAVA_VERSION_FILE);
2222
const architecture = core.getInput(constants.INPUT_ARCHITECTURE);
2323
const packageType = core.getInput(constants.INPUT_JAVA_PACKAGE);
24-
const jdkFile = core.getInput(constants.INPUT_JDK_FILE);
24+
const jdkFile = getJdkFileInput();
2525
const cache = core.getInput(constants.INPUT_CACHE);
2626
const cacheDependencyPath = core.getInput(
2727
constants.INPUT_CACHE_DEPENDENCY_PATH
@@ -128,6 +128,19 @@ async function run() {
128128

129129
run();
130130

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+
131144
async function installVersion(
132145
version: string,
133146
options: installerInputsOptions,

0 commit comments

Comments
 (0)