Skip to content

Commit

Permalink
Update github-workflows-kt version to 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Vampire committed Aug 8, 2024
1 parent 267d269 commit c02372f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 22 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/branches-and-prs.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import io.github.typesafegithub.workflows.domain.triggers.Push
import io.github.typesafegithub.workflows.dsl.expressions.Contexts.github
import io.github.typesafegithub.workflows.dsl.expressions.expr
import io.github.typesafegithub.workflows.dsl.workflow
import io.github.typesafegithub.workflows.yaml.writeToFile

workflow(
name = "Verify Branches and PRs",
Expand All @@ -43,7 +42,7 @@ workflow(
PullRequest(),
MergeGroup()
),
sourceFile = __FILE__.toPath(),
sourceFile = __FILE__,
targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml",
// https://stackoverflow.com/a/72408109/16358266
concurrency = Concurrency(
Expand Down Expand Up @@ -104,4 +103,4 @@ workflow(
action = CodecovActionV4()
)
}
}.writeToFile()
}
5 changes: 2 additions & 3 deletions .github/workflows/codeql-analysis.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import io.github.typesafegithub.workflows.domain.triggers.Schedule
import io.github.typesafegithub.workflows.dsl.expressions.Contexts.github
import io.github.typesafegithub.workflows.dsl.expressions.expr
import io.github.typesafegithub.workflows.dsl.workflow
import io.github.typesafegithub.workflows.yaml.writeToFile

workflow(
name = "Code scanning - action",
Expand All @@ -51,7 +50,7 @@ workflow(
)
)
),
sourceFile = __FILE__.toPath(),
sourceFile = __FILE__,
targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml",
// https://stackoverflow.com/a/72408109/16358266
concurrency = Concurrency(
Expand Down Expand Up @@ -127,4 +126,4 @@ workflow(
action = CodeqlActionAnalyzeV2(_customVersion = "v3")
)
}
}.writeToFile()
}
8 changes: 4 additions & 4 deletions .github/workflows/common.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* limitations under the License.
*/

@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.14.0")
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:2.0.0")

import io.github.typesafegithub.workflows.domain.Job
import io.github.typesafegithub.workflows.domain.JobOutputs.EMPTY
Expand All @@ -31,7 +31,7 @@ import java.util.Properties

val GRADLE_ENTERPRISE_ACCESS_KEY by secrets

val commonCredentials = linkedMapOf(
val commonCredentials = mapOf(
"DEVELOCITY_ACCESS_KEY" to expr(GRADLE_ENTERPRISE_ACCESS_KEY)
)

Expand Down Expand Up @@ -61,7 +61,7 @@ data class Matrix(
.flatMap { element -> (javaVersions ?: listOf(null)).map { element.copy(javaVersion = it) } }
}

fun toCustomArguments() = linkedMapOf(
fun toCustomArguments() = mapOf(
*listOfNotNull(
variants?.let { "variant" to variants },
javaVersions?.let { "java" to javaVersions },
Expand All @@ -85,7 +85,7 @@ data class Matrix(
val variant: String? = null,
val javaVersion: String? = null
) {
fun toCustomArguments() = linkedMapOf(
fun toCustomArguments() = mapOf(
*listOfNotNull(
variant?.let { "variant" to variant },
javaVersion?.let { "java" to javaVersion },
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/docs-pr.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import io.github.typesafegithub.workflows.domain.triggers.Push
import io.github.typesafegithub.workflows.dsl.expressions.Contexts.github
import io.github.typesafegithub.workflows.dsl.expressions.expr
import io.github.typesafegithub.workflows.dsl.workflow
import io.github.typesafegithub.workflows.yaml.writeToFile

workflow(
name = "Verify Docs",
Expand All @@ -42,7 +41,7 @@ workflow(
PullRequest(),
MergeGroup()
),
sourceFile = __FILE__.toPath(),
sourceFile = __FILE__,
targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml",
// https://stackoverflow.com/a/72408109/16358266
concurrency = Concurrency(
Expand Down Expand Up @@ -93,4 +92,4 @@ workflow(
)
)
}
}.writeToFile()
}
5 changes: 2 additions & 3 deletions .github/workflows/gradle-wrapper-validation.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import io.github.typesafegithub.workflows.domain.triggers.MergeGroup
import io.github.typesafegithub.workflows.domain.triggers.PullRequest
import io.github.typesafegithub.workflows.domain.triggers.Push
import io.github.typesafegithub.workflows.dsl.workflow
import io.github.typesafegithub.workflows.yaml.writeToFile

workflow(
name = "Validate Gradle Wrapper",
Expand All @@ -34,7 +33,7 @@ workflow(
PullRequest(),
MergeGroup()
),
sourceFile = __FILE__.toPath(),
sourceFile = __FILE__,
targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml"
) {
job(
Expand All @@ -51,4 +50,4 @@ workflow(
action = WrapperValidationActionV2(_customVersion = "v3")
)
}
}.writeToFile()
}
11 changes: 5 additions & 6 deletions .github/workflows/release.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import io.github.typesafegithub.workflows.dsl.expressions.Contexts.github
import io.github.typesafegithub.workflows.dsl.expressions.Contexts.secrets
import io.github.typesafegithub.workflows.dsl.expressions.expr
import io.github.typesafegithub.workflows.dsl.workflow
import io.github.typesafegithub.workflows.yaml.writeToFile

workflow(
name = "Build and Release Spock",
Expand All @@ -37,7 +36,7 @@ workflow(
tags = listOf("spock-*")
)
),
sourceFile = __FILE__.toPath(),
sourceFile = __FILE__,
targetFileName = "${__FILE__.name.substringBeforeLast(".main.kts")}.yml"
) {
val GITHUB_TOKEN by secrets
Expand Down Expand Up @@ -122,7 +121,7 @@ workflow(
""""-DjavaVersion=${expr(Matrix.javaVersion)}"""",
"-Dscan.tag.main-publish"
).joinToString(" "),
env = linkedMapOf(
env = mutableMapOf(
"GITHUB_TOKEN" to expr(GITHUB_TOKEN),
"SONATYPE_OSS_USER" to expr(SONATYPE_OSS_USER),
"SONATYPE_OSS_PASSWORD" to expr(SONATYPE_OSS_PASSWORD),
Expand All @@ -135,7 +134,7 @@ workflow(
name = "Publish Release Docs",
runsOn = RunnerType.Custom(expr(Matrix.operatingSystem)),
needs = listOf(releaseSpock),
strategyMatrix = linkedMapOf(
strategyMatrix = mapOf(
// docs need the highest variant
"variant" to Matrix.axes.variants.takeLast(1),
// docs need the highest java version
Expand Down Expand Up @@ -172,9 +171,9 @@ workflow(
""""-DjavaVersion=${expr(Matrix.javaVersion)}"""",
"-Dscan.tag.main-docs"
).joinToString(" "),
env = linkedMapOf(
env = mutableMapOf(
"GITHUB_TOKEN" to expr(GITHUB_TOKEN)
).apply { putAll(commonCredentials) }
)
}
}.writeToFile()
}

0 comments on commit c02372f

Please sign in to comment.