Clarify that Gradle Wrapper is assumed for examples

This commit is contained in:
daz 2024-04-01 11:38:10 -06:00 committed by Daz DeBoer
parent c276584302
commit 12646f8198
2 changed files with 12 additions and 3 deletions

View File

@ -4,8 +4,12 @@ This repository contains a set of GitHub Actions that are useful for building Gr
## The `setup-gradle` action ## The `setup-gradle` action
The `setup-gradle` action can be used to configure Gradle for optimal execution on any platform supported by GitHub Actions.
This replaces the previous `gradle/gradle-build-action`, which now delegates to this implementation. This replaces the previous `gradle/gradle-build-action`, which now delegates to this implementation.
The recommended way to execute any Gradle build is with the help of the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), and the examples assume that the Gradle Wrapper has been configured for the project. See [this example](setup-gradle/README.md#build-with-a-specific-gradle-version) if your project doesn't use the Gradle Wrapper.
### Example usage ### Example usage
```yaml ```yaml

View File

@ -22,6 +22,8 @@ These features work both when Gradle is executed via `setup-gradle` and for any
The `setup-gradle` action works by configuring environment variables and by adding a set of Gradle init-scripts to the Gradle User Home. These will apply to all Gradle executions on the runner, no matter how Gradle is invoked. The `setup-gradle` action works by configuring environment variables and by adding a set of Gradle init-scripts to the Gradle User Home. These will apply to all Gradle executions on the runner, no matter how Gradle is invoked.
This means that if you have an existing workflow that executes Gradle with a `run` step, you can add an initial "Setup Gradle" Step to benefit from caching, build-scan capture, and other features of this action. This means that if you have an existing workflow that executes Gradle with a `run` step, you can add an initial "Setup Gradle" Step to benefit from caching, build-scan capture, and other features of this action.
The recommended way to execute any Gradle build is with the help of the [Gradle Wrapper](https://docs.gradle.org/current/userguide/gradle_wrapper.html), and the following examples assume that the Gradle Wrapper has been configured for the project. See [this example](#build-with-a-specific-gradle-version) if your project doesn't use the Gradle Wrapper.
```yaml ```yaml
name: Run Gradle on every push name: Run Gradle on every push
@ -46,15 +48,18 @@ jobs:
run: ./gradlew build run: ./gradlew build
``` ```
## Choose a specific Gradle version ## Build with a specific Gradle version
The `setup-gradle` action can download and install a specified Gradle version, adding this installed version to the PATH. The `setup-gradle` action can download and install a specified Gradle version, adding this installed version to the PATH.
Downloaded Gradle versions are stored in the GitHub Actions cache, to avoid having to download them again later. Downloaded Gradle versions are stored in the GitHub Actions cache, to avoid having to download them again later.
```yaml ```yaml
- uses: gradle/actions/setup-gradle@v3 - name: Setup Gradle 8.5
uses: gradle/actions/setup-gradle@v3
with: with:
gradle-version: 6.5 gradle-version: 8.5
- name: Build with Gradle 8.5
run: gradle build
``` ```
The `gradle-version` parameter can be set to any valid Gradle version. The `gradle-version` parameter can be set to any valid Gradle version.