Skip to content

Commit 4b919f9

Browse files
committed
fix the Gradle configuration cache encryption key input
1 parent 254cdc6 commit 4b919f9

3 files changed

Lines changed: 29 additions & 19 deletions

File tree

readme.md

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,14 @@ This action will set up the Java SDK.
2222
2323
The following inputs can be used as `step.with` keys:
2424

25-
| Name | Required/Default | Description |
26-
|---------------------|------------------------|-------------------------------------------------------------------------------------------------------|
27-
| `working-directory` | `.` | The working directory |
28-
| `java-version` | `21` | Java Version |
29-
| `distribution` | `corretto` | Java Distribution |
30-
| `cache` | `true` | Enable Maven/Gradle dependency caching. |
31-
| `cache-name` | `aboutbits-setup-java` | Cache name. Caches with the same name will share their contents. (Not applicable when Gradle is used) |
25+
| Name | Required/Default | Description |
26+
|------------------------|------------------------|-------------------------------------------------------------------------------------------------------|
27+
| `working-directory` | `.` | The working directory |
28+
| `java-version` | `21` | Java Version |
29+
| `distribution` | `corretto` | Java Distribution |
30+
| `cache` | `true` | Enable Maven/Gradle dependency caching. |
31+
| `cache-name` | `aboutbits-setup-java` | Cache name. Caches with the same name will share their contents. (Not applicable when Gradle is used) |
32+
| `cache-encryption-key` | | Optional encryption key for the Gradle configuration cache. (Not applicable when Maven is used) |
3233

3334
#### Outputs
3435

@@ -60,13 +61,14 @@ You can choose between the Maven and Gradle build tool.
6061

6162
The following inputs can be used as `step.with` keys:
6263

63-
| Name | Required/Default | Description |
64-
|---------------------|------------------------|-------------------------------------------------------------------------------------------------------|
65-
| `working-directory` | `.` | The working directory |
66-
| `java-version` | `21` | Java Version |
67-
| `distribution` | `corretto` | Java Distribution |
68-
| `cache` | `true` | Enable Maven/Gradle dependency caching. |
69-
| `cache-name` | `aboutbits-setup-java` | Cache name. Caches with the same name will share their contents. (Not applicable when Gradle is used) |
64+
| Name | Required/Default | Description |
65+
|------------------------|------------------------|-------------------------------------------------------------------------------------------------------|
66+
| `working-directory` | `.` | The working directory |
67+
| `java-version` | `21` | Java Version |
68+
| `distribution` | `corretto` | Java Distribution |
69+
| `cache` | `true` | Enable Maven/Gradle dependency caching. |
70+
| `cache-name` | `aboutbits-setup-java` | Cache name. Caches with the same name will share their contents. (Not applicable when Gradle is used) |
71+
| `cache-encryption-key` | | Optional encryption key for the Gradle configuration cache. (Not applicable when Maven is used) |
7072

7173
#### Outputs
7274

@@ -81,8 +83,10 @@ The following outputs are forwarded from the underlying `setup-java` and `cache`
8183

8284
## Gradle configuration cache
8385

84-
To enable the Gradle configuration cache, which further improves the build performance in addition to the default enabled wrapper/script/dependency/build cache, a GitHub secret called `GRADLE_ENCRYPTION_KEY` must exist.
85-
If the secret does not exist, Gradle will still work, but the configuration cache will not be saved.
86+
To enable the Gradle configuration cache, which further improves the build performance in addition to the default
87+
enabled wrapper/script/dependency/build cache, create a GitHub secret called `GRADLE_ENCRYPTION_KEY` and pass it to the
88+
`cache-encryption-key` input.
89+
If you do not specify `cache-encryption-key`, Gradle will still work, but the configuration cache will not be saved.
8690
https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#saving-configuration-cache-data
8791

8892
## Versioning

setup-and-install-with-gradle/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ inputs:
1414
cache:
1515
default: 'true'
1616
description: 'Enable Gradle configuration and dependency caching.'
17+
cache-encryption-key:
18+
description: 'Optional encryption key for the Gradle configuration cache'
19+
required: false
1720

1821
outputs:
1922
distribution:
@@ -40,7 +43,7 @@ runs:
4043
uses: gradle/actions/setup-gradle@v4
4144
with:
4245
cache-disabled: ${{ inputs.cache == 'false' }}
43-
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
46+
cache-encryption-key: ${{ inputs.cache-encryption-key }}
4447
cache-read-only: 'false'
4548

4649
- name: Update dependencies

setup-with-gradle/action.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ inputs:
1313
description: 'Java Distribution'
1414
cache:
1515
default: 'true'
16-
description: 'Enable Gradle dependency caching.'
16+
description: 'Enable Gradle configuration and dependency caching.'
17+
cache-encryption-key:
18+
description: 'Optional encryption key for the Gradle configuration cache'
19+
required: false
1720

1821
outputs:
1922
distribution:
@@ -40,5 +43,5 @@ runs:
4043
uses: gradle/actions/setup-gradle@v4
4144
with:
4245
cache-disabled: ${{ inputs.cache == 'false' }}
43-
cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
46+
cache-encryption-key: ${{ inputs.cache-encryption-key }}
4447
cache-read-only: 'false'

0 commit comments

Comments
 (0)