mirror of
https://gitea.com/actions/setup-java.git
synced 2026-08-07 02:31:20 +00:00
955f34f16f
* Add JDK caching Cache resolved JDK tool-cache entries by exact platform and release identity, with a default-on cache-jdk input and explicit opt-out. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Apply batched suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * Fix JDK cache CI validation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Update brace-expansion security fix Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Refresh brace-expansion license metadata Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Refine JDK cache semantics Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Refine JDK cache documentation Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Simplify JDK cache identity Use one normalized runner OS dimension, reset the internal cache key schema for the unreleased feature, and align documentation, tests, and bundles. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Align JDK cache OS identity Use the established RUNNER_OS value directly and retain process.platform only as a non-Actions fallback. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * Harden JDK cache saves and document tool-cache reuse Bind each JDK cache key to the installation identity it was computed for, keep post-job saves best-effort per entry, and state the real reuse and verification guarantee in the documentation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * docs: restructure README caching section Rename '## Caching dependencies' to '## Caching' and add a what-gets-cached overview table covering the dependency, wrapper, and JDK caches. Lead with the common 'cache: maven' example and the dependency-cache material, and demote JDK caching into its own subsection. Also corrects the IMPORTANT callout, which implied JDK caching required an explicit opt-in; it is enabled implicitly whenever 'cache' is set. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * docs: fix caching documentation defects - Remove pull-request framing that compared behavior to `main`; state the tool-cache and `jdkfile` behavior directly and unconditionally. - Clarify that the JDK cache is a separate cache *entry* from the dependency and wrapper caches, while its *enablement* is coupled to `cache`, so the opening paragraph agrees with the enablement matrix. - Cite the actions/setup-java-benchmarks repository instead of an open PR and a self-referential PR comment, keeping the measured figures and caveats. - Keep the `cache`/`cache-jdk` matrix only in docs/advanced-usage.md and summarize the rules in prose in README.md to avoid divergence. - Describe the guarantee that a cache key is only saved with the installation it was computed for, instead of documenting inode/size/timestamp internals. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> * docs: add V6 what's new entry for JDK caching Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: e2755464-4e83-47b6-ba71-731bb481b418 --------- Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Copilot-Session: e2755464-4e83-47b6-ba71-731bb481b418
137 lines
7.7 KiB
YAML
137 lines
7.7 KiB
YAML
name: 'Setup Java JDK'
|
|
description: 'Set up a specific version of the Java JDK and add the
|
|
command-line tools to the PATH'
|
|
author: 'GitHub'
|
|
inputs:
|
|
java-version:
|
|
description: 'The Java version to set up. Takes a whole or semver Java version, or the "latest" alias to use the newest available stable release. See examples of supported syntax in README file'
|
|
required: false
|
|
java-version-file:
|
|
description: 'The path to a file containing the Java version to set up (.java-version, .tool-versions, .sdkmanrc). Used when java-version is not set. See examples of supported syntax in README file'
|
|
required: false
|
|
distribution:
|
|
description: 'Java distribution. See the list of supported distributions in README file. This input is required except when java-version-file points to .sdkmanrc with a recognized distribution suffix (e.g., java=21.0.5-tem).'
|
|
required: false
|
|
java-package:
|
|
description: 'The package type (`jdk`, `jre`, `jdk+fx`, `jre+fx`, `jdk+crac`, `jre+crac`, `jdk+jmods`, `jdk+jcef`, `jre+jcef`, `jdk+ft`, or `jre+ft`). Supported values vary by distribution.'
|
|
required: false
|
|
default: 'jdk'
|
|
architecture:
|
|
description: "The architecture of the package (`x86`, `x64`, `armv7`, `aarch64`, `ppc64le`, `ppc64`, or `s390x`). Aliases `ia32`, `amd64`, `arm`, and `arm64` are normalized to `x86`, `x64`, `armv7`, and `aarch64`. Supported values vary by distribution and operating system. Defaults to the action runner's architecture."
|
|
required: false
|
|
jdk-file:
|
|
description: 'Path to where the compressed JDK is located'
|
|
required: false
|
|
jdkFile:
|
|
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.'
|
|
required: false
|
|
deprecationMessage: 'The `jdkFile` input is deprecated. Use `jdk-file` instead.'
|
|
check-latest:
|
|
description: 'Set this option if you want the action to check for the latest available version that satisfies the version spec'
|
|
required: false
|
|
default: false
|
|
force-download:
|
|
description: 'Set this option to always download Java and replace any matching version in the tool cache'
|
|
required: false
|
|
default: false
|
|
set-default:
|
|
description: 'Set this option to false if you want to install a JDK but not make it the default. When false, JAVA_HOME and PATH are not updated, but JAVA_HOME_<major>_<arch> is still set.'
|
|
required: false
|
|
default: true
|
|
verify-signature:
|
|
description: 'Verify downloaded Java package signatures when supported by the selected distribution'
|
|
required: false
|
|
default: false
|
|
verify-signature-public-key:
|
|
description: 'ASCII-armored GPG public key used to verify the downloaded package signature. Overrides the default bundled key for the selected distribution.'
|
|
required: false
|
|
server-id:
|
|
description: 'ID of the distributionManagement repository in the pom.xml
|
|
file. Default is `github`'
|
|
required: false
|
|
default: 'github'
|
|
server-username-env-var:
|
|
description: 'Environment variable name for the username for authentication
|
|
to the Apache Maven repository. Default is $GITHUB_ACTOR'
|
|
required: false
|
|
server-username:
|
|
description: 'Deprecated alias for server-username-env-var'
|
|
required: false
|
|
server-password-env-var:
|
|
description: 'Environment variable name for password or token for
|
|
authentication to the Apache Maven repository. Default is $GITHUB_TOKEN'
|
|
required: false
|
|
server-password:
|
|
description: 'Deprecated alias for server-password-env-var'
|
|
required: false
|
|
settings-path:
|
|
description: 'Path to where the settings.xml file will be written. Default is ~/.m2.'
|
|
required: false
|
|
overwrite-settings:
|
|
description: 'Overwrite the settings.xml file if it exists. Default is "true".'
|
|
required: false
|
|
default: true
|
|
gpg-private-key:
|
|
description: 'GPG private key to import. Default is empty string.'
|
|
required: false
|
|
default: ''
|
|
gpg-passphrase-env-var:
|
|
description: 'Environment variable name for the GPG private key passphrase. Defaults to GPG_PASSPHRASE when gpg-private-key is set.'
|
|
required: false
|
|
gpg-passphrase:
|
|
description: 'Deprecated alias for gpg-passphrase-env-var'
|
|
required: false
|
|
cache:
|
|
description: 'Name of the build platform to cache dependencies. It can be "maven", "gradle" or "sbt".'
|
|
required: false
|
|
cache-jdk:
|
|
description: 'Cache downloaded JDK installations between jobs. Defaults to enabled when dependency caching is configured with `cache`; set explicitly to "true" or "false" to override.'
|
|
required: false
|
|
cache-dependency-path:
|
|
description: 'The path to a dependency file: pom.xml, build.gradle, build.sbt, etc. This option can be used with the `cache` option. If this option is omitted, the action searches for the dependency file in the entire repository. This option supports wildcards and a list of file names for caching multiple dependencies.'
|
|
required: false
|
|
cache-path:
|
|
description: 'The path to cache instead of the default dependency cache path for the selected package manager. This option can be used with the `cache` option and supports a list of paths and exclusion patterns.'
|
|
required: false
|
|
cache-read-only:
|
|
description: 'Restore caches without saving cache changes in the post action.'
|
|
required: false
|
|
default: false
|
|
job-status:
|
|
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
|
required: false
|
|
default: ${{ job.status }}
|
|
token:
|
|
description: The token used to authenticate when fetching version manifests hosted on github.com, such as for the Microsoft Build of OpenJDK. When running this action on github.com, the default value is sufficient. When running on GHES, you can pass a personal access token for github.com if you are experiencing rate limiting.
|
|
required: false
|
|
default: ${{ github.server_url == 'https://github.com' && github.token || '' }}
|
|
mvn-toolchain-id:
|
|
description: 'Name of Maven Toolchain ID if the default name of "${distribution}_${java-version}" is not wanted. When supplied, the number of IDs must match the number of Java versions. See examples of supported syntax in Advanced Usage file'
|
|
required: false
|
|
mvn-toolchain-vendor:
|
|
description: 'Name of Maven Toolchain Vendor if the default name of "${distribution}" is not wanted. See examples of supported syntax in Advanced Usage file'
|
|
required: false
|
|
show-download-progress:
|
|
description: 'Whether Maven should print artifact download/transfer progress to the build log. When "false" (default) the action sets "-ntp" (--no-transfer-progress) in MAVEN_ARGS to produce cleaner logs. Set to "true" to keep the progress output. Has no effect on non-Maven builds.'
|
|
required: false
|
|
default: false
|
|
problem-matcher:
|
|
description: 'Whether to register the Java problem matcher (compiler errors/warnings and uncaught exceptions). Set to "false" to disable annotations.'
|
|
required: false
|
|
default: true
|
|
outputs:
|
|
distribution:
|
|
description: 'Distribution of Java that has been installed'
|
|
version:
|
|
description: 'Actual version of the java environment that has been installed'
|
|
path:
|
|
description: 'Path to where the java environment has been installed (same as $JAVA_HOME)'
|
|
cache-hit:
|
|
description: 'A boolean value to indicate an exact match was found for the primary key'
|
|
cache-primary-key:
|
|
description: 'The primary cache key computed by the action for the configured build tool. Empty when caching is not enabled or when caching is skipped (e.g. cache service unavailable). Useful for composing with actions/cache or actions/cache/restore across jobs.'
|
|
runs:
|
|
using: 'node24'
|
|
main: 'dist/setup/index.js'
|
|
post: 'dist/cleanup/index.js'
|