jenkins-x-plugins/jx-release-version

Possibility to add new version into the package.json from a new build version

Closed this issue · 2 comments

Hello,

We have some repos that work on NodeJS, and then we use a package.json to declare our versions.
I need to, when a build is running, that this build update the version into my package.json.

Then when i launch a build => he incremente and add a new version into package.json ==> then create a release with this version for github.

Do you think its possible ?

I use AKS cluster with jenkins-x v2

Thanks for all

Hi,

sure, you can do it with multiple steps:

VERSION=$(jx-release-version)
jq -r --arg VERSION "$VERSION" '.version |= $VERSION' package.json > package.json
git tag ...

the scope of the jx-release-version binary is just to display the next release version, not to update files or create git tag. But you can easily chain commands in your pipeline to do exactly what you want.

Thanks for the quickly response.

I have to test this and then if u have an example of pipelineConfig to overrides the step to do this ?

I came back to you quickly