You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create a Kotlin CLI to improve overall developer workflow #464
An executable, let's calll it gakd for now, (not an actual good name), to make it easier to get started with the library and with the manual boring tasks.
$ gakd
Authoring GitHub Actions workflows in Kotlin.
gakd init Bootstrap your repository
gakd sync Sync all YAML files
gakd convert Convert your YAML files to a Kotlin script
gakd doctor trouble shooting
gakd docs Open https://krzema12.github.io/github-actions-kotlin-dsl
gakd github Open https://github.com/krzema12/github-actions-kotlin-dsl
Is there a workaround for not having this feature? If yes, please describe it.
changed the title [-]Create a Kotlin executable to improve overallall developer workflow[/-][+]Create a Kotlin CLI to improve overallall developer workflow[/+]on Sep 28, 2022
changed the title [-]Create a Kotlin CLI to improve overallall developer workflow[/-][+]Create a Kotlin CLI to improve overall developer workflow[/+]on Sep 28, 2022
I haven't thought about this in a more profound way, but integration with Gradle should be great.
I don't know the current implementation details and names so I will create some ones.
For example, if the API exposed is similar to how Gradle tasks work, I.E. an interface has to be implemented to create a workflow file, I would expect something like:
fun interfaceGitHubActionKotlinDSL {
fun GitHubDSL.run()
}
Implemented in an included build:
val fooWorkflow =GitHubActionKotlinDSL {
// implement the foo workflow with the DSL here
}
val barWorkflow =GitHubActionKotlinDSL {
// implement the bar workflow with the DSL here
}
And the Kotlin Plugin applied (root project):
plugins {
id("gha-dsl-gradle-plugin") // whatever name
}
gitHubActionsKotlinDSL {
workflows.set(listOf(fooWorkflow, barWorkflow))
// or
workflows(fooWorkflow, barWorkflow)
}
A Gradle task with whatever generateGhaDsl name will be attached to the assemble task.
Another advantage is, those foo/bar workflows can be published to MavenCentral and added to any Gradle project too.
@JavierSegoviaCordoba writing a Gradle plugin is possible
the issue I see is that if github-actions.kts becomes popular enough,
we will have people using lots of different build systems.
Could be maven.
Could be a guy doing TypeScript or Rust at the moment but who also knows a bit of Kotlin and prefer it over YAML
etc.
Activity
jmfayard commentedon Sep 28, 2022
Some note on the Slack thread on what the executable could do
jmfayard commentedon Sep 28, 2022
Some note on how to build the CLI tool
I have some experience with it due to https://github.com/jmfayard/kotlin-cli-starter
And my suggestion will sounds surprising but I would recommend to implement the script with Kotlin/JS
Why? Because distribution on native and on the JVM sucks.
On the other hand everything is in place with node.js/npm
[-]Create a Kotlin executable to improve overallall developer workflow[/-][+]Create a Kotlin CLI to improve overallall developer workflow[/+][-]Create a Kotlin CLI to improve overallall developer workflow[/-][+]Create a Kotlin CLI to improve overall developer workflow[/+]JavierSegoviaCordoba commentedon Sep 30, 2022
I haven't thought about this in a more profound way, but integration with Gradle should be great.
I don't know the current implementation details and names so I will create some ones.
For example, if the API exposed is similar to how Gradle tasks work, I.E. an
interfacehas to be implemented to create a workflow file, I would expect something like:Implemented in an included build:
And the Kotlin Plugin applied (root project):
plugins { id("gha-dsl-gradle-plugin") // whatever name } gitHubActionsKotlinDSL { workflows.set(listOf(fooWorkflow, barWorkflow)) // or workflows(fooWorkflow, barWorkflow) }A Gradle task with whatever
generateGhaDslname will be attached to the assemble task.Another advantage is, those foo/bar workflows can be published to MavenCentral and added to any Gradle project too.
jmfayard commentedon Sep 30, 2022
@JavierSegoviaCordoba writing a Gradle plugin is possible
the issue I see is that if github-actions.kts becomes popular enough,
we will have people using lots of different build systems.
Could be maven.
Could be a guy doing TypeScript or Rust at the moment but who also knows a bit of Kotlin and prefer it over YAML
etc.
krzema12 commentedon Jun 2, 2023
It would be nice to have this, but I guess it's not needed for v1.
jmfayard commentedon Jun 3, 2023
For https://github.com/typesafegithub/yaml2kotlin I'm entirely focused on the web app solution, not on the CLI