Reputation: 437
Here is my package.json looks like:
{
"name": "Myproject",
"version": "0.4.13",
Note:Here
4
is not the minor version.0013
is minor
"dependencies": {
"lodash": "^4.0.0",
"vinyl-fs": "2.2.1"
},
"repository": {},
"devDependencies": {
.........
......
How can I automate versioning of package.json using Jenkins build.
Required format should be: 0.4.13-$BUILD_NUMBER So far I try to do it using sed command:
sed -i "s/version: .*/version: 0.4.13-$BUILD_NUMBER/" package.json
But it's not updating version number in package.json file. Also used
npm version 0.4.13-$BUILD_NUMBER
FYI:The generated build artifact should look like 0.0013-1.war
Upvotes: 13
Views: 15778