Reputation: 15394
When running my Jenkins build i need to update the contents of a file with a version number in this case. I have come across a plugin called text-file-operations
but rather than write a whole new file I thought it would be better to update.
In this example I have a podspec file located in the root of the project which just needs a version number updated with a variable I have created earlier in the process.
spec.version = '13.4.0'
I just need to convert that to
spec.version = "${VERSION_NUMBER}"
Is there a way to do this ?
Upvotes: 4
Views: 18379
Reputation: 954
Is this what you want then?
Groovy + how to append text in file ( new line )
f = new File('<filename>')
f.append("spec.version = ${VERSION_NUMBER}\n")
Upvotes: 4