Skip to content

Commit c9f0e1e

Browse files
authored
fix(ci): use Gradle encryption key for storing configuration cache (#1322)
Per the docs: https://github.com/gradle/actions/tree/main/setup-gradle#saving-configuration-cache-data This is the only missing element.
1 parent b3b55d7 commit c9f0e1e

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

.github/workflows/build.main.kts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,13 @@ import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
1212
import io.github.typesafegithub.workflows.domain.RunnerType.Windows2022
1313
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
1414
import io.github.typesafegithub.workflows.domain.triggers.Push
15+
import io.github.typesafegithub.workflows.dsl.expressions.Contexts
1516
import io.github.typesafegithub.workflows.dsl.expressions.expr
1617
import io.github.typesafegithub.workflows.dsl.workflow
1718
import io.github.typesafegithub.workflows.yaml.writeToFile
1819

20+
val GRADLE_ENCRYPTION_KEY by Contexts.secrets
21+
1922
@OptIn(ExperimentalClientSideBindings::class)
2023
workflow(
2124
name = "Build",
@@ -32,7 +35,9 @@ workflow(
3235
) {
3336
uses(action = Checkout())
3437
setupJava()
35-
uses(action = ActionsSetupGradle())
38+
uses(action = ActionsSetupGradle(
39+
cacheEncryptionKey = expr { GRADLE_ENCRYPTION_KEY },
40+
))
3641
run(
3742
name = "Build",
3843
command = "./gradlew build",

.github/workflows/build.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ jobs:
4040
distribution: 'zulu'
4141
- id: 'step-2'
4242
uses: 'gradle/actions/setup-gradle@v3'
43+
with:
44+
cache-encryption-key: '${{ secrets.GRADLE_ENCRYPTION_KEY }}'
4345
- id: 'step-3'
4446
name: 'Build'
4547
run: './gradlew build'
@@ -58,6 +60,8 @@ jobs:
5860
distribution: 'zulu'
5961
- id: 'step-2'
6062
uses: 'gradle/actions/setup-gradle@v3'
63+
with:
64+
cache-encryption-key: '${{ secrets.GRADLE_ENCRYPTION_KEY }}'
6165
- id: 'step-3'
6266
name: 'Build'
6367
run: './gradlew build'

0 commit comments

Comments
 (0)