![]() Run: kotlin /path/in/repo/to/my-script.main. There is also a GitHub action called setup-kotlin that lets you install your desired version of Kotlin and also provides some more features. Val readmeFirstLine = input.readLines().first() Val input = File("README.md") // Assuming you ran checkout before Run: kotlin /path/in/repo/to/Īnd here is an example file: java.io.File ![]() main.kts scripts like this: name: Example Refer to the GitHub Actions runner images 1 to see all the installed software. It has been written by JetBrains core Kotlin developers Dmitry Jemerov and Svetlana Isakova. It will teach you how to write clean and idiomatic code and how Kotlin & Java work together. Kotlin runner is now pre-installed on GitHub Actions environments ( GitHub issue, YouTube video). If you are an experienced Java developer looking for a book to learn Kotlin, this book is for you. Note that if the script has the execute ( x) permission, as I told previously, you can remove the kotlinc -script part and it will still run.īonus: it is possible to have Kotlin code directly in the workflow file (though I'd not recommend doing it), by using kotlin as a shell. workflow file) that will take an input and pass it to your Kotlin script (usable in the args property/parameter) after it installed Kotlin: name: Run Kotlin script If you add the execute permission to the file ( chmod +x on Linux/macOS), you'll also be able to run it just like any other script, without having to type kotlinc -script before, and that will apply on GitHub Actions as well.įinally, here's an example manual GitHub Action (aka. ![]() That will be helpful to test the script locally before running in CI, as the IDE will show a run button in the gutter, next to the shebang. Second, ensure that its first line is the shebang pointing to the right place: #!/usr/bin/env kotlin This book is one of three products included in the Java and Kotlin Hands-on bundle. IntelliJ IDEA, Android Studio), especially when it comes to autocompletion and type analysis. Kotlin in Action guides experienced Java developers from the language basics of Kotlin all the way through building applications to run on the JVM and Android devices. main.kts as that latter one will be recognized better by the IDE (e.g. UPDATE: Kotlin is now pre-installed on GitHub Actions runners, no need to install it beforehand anymore.įirst, ensure that you have a proper Kotlin script, ending in.
0 Comments
Leave a Reply. |