Skip to content

Commit 9c1480a

Browse files
committed
Use Maven-based bindings for GitHub Actions workflows DSL
1 parent 2c0326d commit 9c1480a

9 files changed

+72
-54
lines changed

.github/workflows/check-action-typing.main.kts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env kotlin
22

33
/*
4-
* Copyright 2020-2023 Björn Kautler
4+
* Copyright 2020-2024 Björn Kautler
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -17,9 +17,12 @@
1717
*/
1818

1919
@file:Import("workflow-with-copyright.main.kts")
20+
@file:Repository("https://bindings.krzeminski.it/")
21+
@file:DependsOn("actions:checkout:v4")
22+
@file:DependsOn("typesafegithub:github-actions-typing:v1")
2023

21-
import io.github.typesafegithub.workflows.actions.actions.CheckoutV3
22-
import io.github.typesafegithub.workflows.actions.typesafegithub.GithubActionsTypingV1
24+
import io.github.typesafegithub.workflows.actions.actions.Checkout
25+
import io.github.typesafegithub.workflows.actions.typesafegithub.GithubActionsTyping
2326
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
2427
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
2528
import io.github.typesafegithub.workflows.domain.triggers.Push
@@ -43,11 +46,11 @@ workflowWithCopyright(
4346
)
4447
uses(
4548
name = "Checkout",
46-
action = CheckoutV3()
49+
action = Checkout()
4750
)
4851
uses(
4952
name = "Check Action Typing",
50-
action = GithubActionsTypingV1()
53+
action = GithubActionsTyping()
5154
)
5255
}
5356
}

.github/workflows/check-action-typing.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020-2023 Björn Kautler
1+
# Copyright 2020-2024 Björn Kautler
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ jobs:
4545
run: 'git config --global core.autocrlf input'
4646
- id: 'step-1'
4747
name: 'Checkout'
48-
uses: 'actions/checkout@v3'
48+
uses: 'actions/checkout@v4'
4949
- id: 'step-2'
5050
name: 'Check Action Typing'
5151
uses: 'typesafegithub/github-actions-typing@v1'

.github/workflows/check-dependency-versions.main.kts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env kotlin
22

33
/*
4-
* Copyright 2020-2023 Björn Kautler
4+
* Copyright 2020-2024 Björn Kautler
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -17,11 +17,15 @@
1717
*/
1818

1919
@file:Import("workflow-with-copyright.main.kts")
20+
@file:Repository("https://bindings.krzeminski.it/")
21+
@file:DependsOn("actions:checkout:v4")
22+
@file:DependsOn("actions:setup-java:v4")
23+
@file:DependsOn("burrunan:gradle-cache-action:v1")
2024

21-
import io.github.typesafegithub.workflows.actions.actions.CheckoutV3
22-
import io.github.typesafegithub.workflows.actions.actions.SetupJavaV3
23-
import io.github.typesafegithub.workflows.actions.actions.SetupJavaV3.Distribution.Temurin
24-
import io.github.typesafegithub.workflows.actions.burrunan.GradleCacheActionV1
25+
import io.github.typesafegithub.workflows.actions.actions.Checkout
26+
import io.github.typesafegithub.workflows.actions.actions.SetupJava
27+
import io.github.typesafegithub.workflows.actions.actions.SetupJava.Distribution.Temurin
28+
import io.github.typesafegithub.workflows.actions.burrunan.GradleCacheAction
2529
import io.github.typesafegithub.workflows.domain.RunnerType.WindowsLatest
2630
import io.github.typesafegithub.workflows.domain.triggers.Cron
2731
import io.github.typesafegithub.workflows.domain.triggers.Schedule
@@ -52,18 +56,18 @@ workflowWithCopyright(
5256
)
5357
uses(
5458
name = "Checkout",
55-
action = CheckoutV3()
59+
action = Checkout()
5660
)
5761
uses(
5862
name = "Setup Java 11",
59-
action = SetupJavaV3(
63+
action = SetupJava(
6064
javaVersion = "11",
6165
distribution = Temurin
6266
)
6367
)
6468
uses(
6569
name = "Check Dependency Versions",
66-
action = GradleCacheActionV1(
70+
action = GradleCacheAction(
6771
arguments = listOf("--show-version", "dependencyUpdates"),
6872
debug = false,
6973
concurrent = true

.github/workflows/check-dependency-versions.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020-2023 Björn Kautler
1+
# Copyright 2020-2024 Björn Kautler
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -45,10 +45,10 @@ jobs:
4545
run: 'git config --global core.autocrlf input'
4646
- id: 'step-1'
4747
name: 'Checkout'
48-
uses: 'actions/checkout@v3'
48+
uses: 'actions/checkout@v4'
4949
- id: 'step-2'
5050
name: 'Setup Java 11'
51-
uses: 'actions/setup-java@v3'
51+
uses: 'actions/setup-java@v4'
5252
with:
5353
java-version: '11'
5454
distribution: 'temurin'

.github/workflows/test.main.kts

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env kotlin
22

33
/*
4-
* Copyright 2020-2023 Björn Kautler
4+
* Copyright 2020-2024 Björn Kautler
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -17,15 +17,22 @@
1717
*/
1818

1919
@file:Import("workflow-with-copyright.main.kts")
20+
@file:Repository("https://bindings.krzeminski.it/")
21+
@file:DependsOn("actions:cache__restore:v4")
22+
@file:DependsOn("actions:cache__save:v4")
23+
@file:DependsOn("actions:checkout:v4")
24+
@file:DependsOn("actions:setup-java:v4")
25+
@file:DependsOn("burrunan:gradle-cache-action:v1")
26+
@file:DependsOn("Vampire:setup-wsl:v3")
2027

21-
import io.github.typesafegithub.workflows.actions.actions.CacheRestoreV4
22-
import io.github.typesafegithub.workflows.actions.actions.CacheSaveV4
23-
import io.github.typesafegithub.workflows.actions.actions.CheckoutV4
24-
import io.github.typesafegithub.workflows.actions.actions.SetupJavaV4
25-
import io.github.typesafegithub.workflows.actions.actions.SetupJavaV4.Distribution.Temurin
26-
import io.github.typesafegithub.workflows.actions.burrunan.GradleCacheActionV1
27-
import io.github.typesafegithub.workflows.actions.vampire.SetupWslV3
28-
import io.github.typesafegithub.workflows.actions.vampire.SetupWslV3.Distribution
28+
import io.github.typesafegithub.workflows.actions.actions.CacheRestore
29+
import io.github.typesafegithub.workflows.actions.actions.CacheSave
30+
import io.github.typesafegithub.workflows.actions.actions.Checkout
31+
import io.github.typesafegithub.workflows.actions.actions.SetupJava
32+
import io.github.typesafegithub.workflows.actions.actions.SetupJava.Distribution.Temurin
33+
import io.github.typesafegithub.workflows.actions.burrunan.GradleCacheAction
34+
import io.github.typesafegithub.workflows.actions.vampire.SetupWsl
35+
import io.github.typesafegithub.workflows.actions.vampire.SetupWsl.Distribution
2936
import io.github.typesafegithub.workflows.domain.CommandStep
3037
import io.github.typesafegithub.workflows.domain.ActionStep
3138
import io.github.typesafegithub.workflows.domain.JobOutputs.EMPTY
@@ -129,7 +136,7 @@ val wslBash = Shell.Custom("wsl-bash {0}")
129136

130137
val wslSh = Shell.Custom("wsl-sh {0}")
131138

132-
lateinit var executeActionStep: ActionStep<SetupWslV3.Outputs>
139+
lateinit var executeActionStep: ActionStep<SetupWsl.Outputs>
133140

134141
workflowWithCopyright(
135142
name = "Build and Test",
@@ -145,7 +152,7 @@ workflowWithCopyright(
145152
"build/distributions/"
146153
)
147154

148-
val executeAction = SetupWslV3(
155+
val executeAction = SetupWsl(
149156
distribution = Distribution.Custom(expr("matrix.distribution.user-id"))
150157
)
151158

@@ -160,18 +167,18 @@ workflowWithCopyright(
160167
)
161168
uses(
162169
name = "Checkout",
163-
action = CheckoutV4()
170+
action = Checkout()
164171
)
165172
uses(
166173
name = "Setup Java 11",
167-
action = SetupJavaV4(
174+
action = SetupJava(
168175
javaVersion = "11",
169176
distribution = Temurin
170177
)
171178
)
172179
uses(
173180
name = "Build",
174-
action = GradleCacheActionV1(
181+
action = GradleCacheAction(
175182
arguments = listOf(
176183
"--show-version",
177184
"build",
@@ -185,7 +192,7 @@ workflowWithCopyright(
185192
)
186193
uses(
187194
name = "Save built artifacts to cache",
188-
action = CacheSaveV4(
195+
action = CacheSave(
189196
path = builtArtifacts,
190197
key = expr { github.run_id }
191198
)
@@ -206,7 +213,7 @@ workflowWithCopyright(
206213
) {
207214
uses(
208215
name = "Restore built artifacts from cache",
209-
action = CacheRestoreV4(
216+
action = CacheRestore(
210217
path = builtArtifacts,
211218
key = expr { github.run_id },
212219
failOnCacheMiss = true
@@ -266,7 +273,7 @@ workflowWithCopyright(
266273
)
267274
) {
268275
executeActionStep = usesSelf(
269-
action = SetupWslV3(
276+
action = SetupWsl(
270277
update = true
271278
)
272279
)
@@ -686,26 +693,26 @@ workflowWithCopyright(
686693
) {
687694
usesSelf(
688695
name = "Execute action for ${expr("matrix.distributions.distribution1.user-id")}",
689-
action = SetupWslV3(
696+
action = SetupWsl(
690697
distribution = Distribution.Custom(expr("matrix.distributions.distribution1.user-id"))
691698
)
692699
)
693700
usesSelf(
694701
name = "Execute action for ${expr("matrix.distributions.distribution2.user-id")}",
695-
action = SetupWslV3(
702+
action = SetupWsl(
696703
distribution = Distribution.Custom(expr("matrix.distributions.distribution2.user-id"))
697704
)
698705
)
699706
usesSelf(
700707
name = "Execute action for ${expr("matrix.distributions.distribution3.user-id")}",
701-
action = SetupWslV3(
708+
action = SetupWsl(
702709
distribution = Distribution.Custom(expr("matrix.distributions.distribution3.user-id")),
703710
setAsDefault = false
704711
)
705712
)
706713
executeActionStep = usesSelf(
707714
name = "Execute action for ${expr("matrix.distributions.distribution1.user-id")} again",
708-
action = SetupWslV3(
715+
action = SetupWsl(
709716
distribution = Distribution.Custom(expr("matrix.distributions.distribution1.user-id"))
710717
)
711718
)
@@ -783,7 +790,7 @@ workflowWithCopyright(
783790
)
784791
executeActionStep = usesSelfAfterSuccess(
785792
name = "Execute action for ${expr("matrix.distribution2.user-id")}",
786-
action = SetupWslV3(
793+
action = SetupWsl(
787794
distribution = Distribution.Custom(expr("matrix.distribution2.user-id"))
788795
)
789796
)
@@ -842,7 +849,7 @@ workflowWithCopyright(
842849
.associateWith {
843850
usesSelf(
844851
name = "Execute action for ${expr("matrix.distributions.distribution$it.user-id")}",
845-
action = SetupWslV3(
852+
action = SetupWsl(
846853
distribution = Distribution.Custom(expr("matrix.distributions.distribution$it.user-id")),
847854
additionalPackages = if (it == 2) listOf("bash") else null,
848855
setAsDefault = if (it >= 3) false else null
@@ -934,7 +941,7 @@ fun JobBuilder<*>.commonTests() {
934941

935942
fun JobBuilder<*>.usesSelfAfterSuccess(
936943
name: String = "Execute action",
937-
action: SetupWslV3
944+
action: SetupWsl
938945
) = usesSelf(
939946
name = name,
940947
action = action,
@@ -943,7 +950,7 @@ fun JobBuilder<*>.usesSelfAfterSuccess(
943950

944951
fun JobBuilder<*>.usesSelf(
945952
name: String = "Execute action",
946-
action: SetupWslV3,
953+
action: SetupWsl,
947954
condition: String? = null,
948955
continueOnError: Boolean? = null
949956
) = uses(

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020-2023 Björn Kautler
1+
# Copyright 2020-2024 Björn Kautler
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.

.github/workflows/validate-gradle-wrapper.main.kts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env kotlin
22

33
/*
4-
* Copyright 2020-2023 Björn Kautler
4+
* Copyright 2020-2024 Björn Kautler
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.
@@ -17,9 +17,12 @@
1717
*/
1818

1919
@file:Import("workflow-with-copyright.main.kts")
20+
@file:Repository("https://bindings.krzeminski.it/")
21+
@file:DependsOn("actions:checkout:v4")
22+
@file:DependsOn("gradle:wrapper-validation-action:v1")
2023

21-
import io.github.typesafegithub.workflows.actions.actions.CheckoutV3
22-
import io.github.typesafegithub.workflows.actions.gradle.WrapperValidationActionV1
24+
import io.github.typesafegithub.workflows.actions.actions.Checkout
25+
import io.github.typesafegithub.workflows.actions.gradle.WrapperValidationAction
2326
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest
2427
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
2528
import io.github.typesafegithub.workflows.domain.triggers.Push
@@ -43,11 +46,11 @@ workflowWithCopyright(
4346
)
4447
uses(
4548
name = "Checkout",
46-
action = CheckoutV3()
49+
action = Checkout()
4750
)
4851
uses(
4952
name = "Validate Gradle Wrapper",
50-
action = WrapperValidationActionV1()
53+
action = WrapperValidationAction()
5154
)
5255
}
5356
}

.github/workflows/validate-gradle-wrapper.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright 2020-2023 Björn Kautler
1+
# Copyright 2020-2024 Björn Kautler
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@ jobs:
4545
run: 'git config --global core.autocrlf input'
4646
- id: 'step-1'
4747
name: 'Checkout'
48-
uses: 'actions/checkout@v3'
48+
uses: 'actions/checkout@v4'
4949
- id: 'step-2'
5050
name: 'Validate Gradle Wrapper'
5151
uses: 'gradle/wrapper-validation-action@v1'

.github/workflows/workflow-with-copyright.main.kts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2023 Björn Kautler
2+
* Copyright 2020-2024 Björn Kautler
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:2.0.0")
17+
@file:Repository("https://repo.maven.apache.org/maven2/")
18+
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:2.3.0")
1819

1920
import io.github.typesafegithub.workflows.domain.Concurrency
2021
import io.github.typesafegithub.workflows.domain.triggers.Trigger
@@ -39,7 +40,7 @@ fun workflowWithCopyright(
3940
concurrency = concurrency,
4041
preamble = WithOriginalAfter(
4142
"""
42-
Copyright 2020-2023 Björn Kautler
43+
Copyright 2020-2024 Björn Kautler
4344
4445
Licensed under the Apache License, Version 2.0 (the "License");
4546
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)