I just released a new version of a library success...
# scripting
l
I just released a new version of a library successfully with all the steps involved thanks to Kotlin scripting! πŸŽ‰ πŸŽ‰ πŸŽ‰ I'm so happy about it I want to share that script that makes the release steps semi-automatic and less error-prone: https://github.com/LouisCAD/Splitties/blob/61e9f223219f0c1c894be77c334d826413ed720c/Releasing.kts You can see that before, it was a fully manual and error-prone 19 steps process: https://github.com/LouisCAD/Splitties/blob/61e9f223219f0c1c894be77c334d826413ed720c/RELEASING.md Maybe it can inspire you or even suit your need straightaway. Special thanks to @Nikky that got me on track to run OS commands from JDK APIs (to access things like
git
).
πŸ‘ 4
n
btw i would recomemnd to change from
command: String
to
vararg command: String
, just so you can make sure there is no accidental splitting going on
i moved the debug printing of which command it runs into the execution function and at most pass a boolean along to trigger which level it prints on, debug or info
but this looks very cool
πŸ™‚ 1
l
@Nikky I added support for double quotes like
git commit -am "I did it!"
with the regex I copy pasted from the web for that purpose, so I can use
String
. I prefer this as it looks the same as usage from command line, improving readability which also impacts safety.
n
yeah this seems fine, lets just hope you never need to have escaped quotes inside strings or so
j
Niiiiice
😊 1
l
@Nikky In that case, I would surely test it first, followed by a
TODO()
call
πŸ˜‚ 1
Here's the result BTW:
πŸ’― 1
I intentionally added colors so I can easily distinguish prompts of the script, from output of commands executed by the script.
Also, the output is indeed longer, the screenshot only shows the end.
y
There are some nice libraries that could simplify this a lot. Jansi for dealing with console colour support. Zero turnaround ztexec for process handling. And putting some of this inside Gradle as kotlin custom build steps even.
πŸ‘ 2
e
This is pretty cool @louiscad I had plans for something like this (automating releases) for my app when I’m done but boy am I glad I dont have to (fully) write it from scratch myself πŸ˜‚
πŸ™‚ 1