From 87ce60218663ca56bfa1dc3b194ed7d46a2d585b Mon Sep 17 00:00:00 2001 From: Maxim Lobanov Date: Tue, 23 Mar 2021 17:46:29 +0300 Subject: [PATCH] Update README.md --- README.md | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84429bd1..4d2440b5 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,24 @@ Currently, the following distributions are supported: **NOTE:** The different distributors can provide discrepant list of available versions / supported configurations. Please refer to the official documentation to see the list of supported versions. -#### Testing against different Java versions +### Check latest +In the basic examples above, the `check-latest` flag defaults to `false`. When set to `false`, the action tries to first resolve a version of Java from the local cache. If unable to find a specific version in the cache, the action will download a version of Java. Use the default or set `check-latest` to `false` if you prefer stability and if you want to ensure a specific version of Java is always used. +The local version of Java in cache gets updated on weekly basis. For information regarding locally cached versions of Java on GitHub hosted runners, check out [GitHub Actions Virtual Environments](https://github.com/actions/virtual-environments). + +If `check-latest` is set to `true`, the action first checks if the cached version is the latest one. If the locally cached version is not the most up-to-date, the latest version of Java will be downloaded. Set `check-latest` to `true` if you want the most up-to-date version of Java to always be used. Setting `check-latest` to `true` has performance implications as downloading versions of Java is slower than using cached versions. + +```yaml +steps: +- uses: actions/checkout@v2 +- uses: actions/setup-java@v2-preview + with: + distribution: 'adopt' + java-version: '11' + check-latest: true +- run: java -cp java HelloWorldApp +``` + +### Testing against different Java versions ```yaml jobs: build: @@ -90,7 +107,6 @@ jobs: - [Publishing using Apache Maven](docs/advanced-usage.md#Publishing-using-Apache-Maven) - [Publishing using Gradle](docs/advanced-usage.md#Publishing-using-Gradle) - ## License The scripts and documentation in this project are released under the [MIT License](LICENSE)