Closed djechelon closed 9 months ago
I'm on the fence about whether this should be part of the plugin. But in the meantime, this is pretty easy to just add to your build.gradle.
tasks.register('versionFile') {
doLast {
file("${buildDir}/version.txt").text = version.toString()
}
}
You could do more to add inputs that avoid re-writing it, but it depends on the use case. If you only run it when publishing (or in a clean repo state in CI) you can keep it simple.
No plan to provide this in the plugin, the workaround posted earlier should meet the need though.
Why?
I am using Azure DevOps Pipelines, and one of my dirty tasks is to identify the artifact version to be used in the next stages, especially when the artifact is a Docker artifact
Currently, Jib writes the Docker Image ID to $buildDir/jib-image.id, which is damn cool.
What if reckon writes a similar file? I could catch up in a subsequent step, using
vso.setVariable
consuming the contents of the file. This way, the assigned artifact version will be available to subsequent DevOps stages and steps