Woland Woland - 11 months ago 90
Git Question

How to push changes to github after jenkins build completes?

I have a jenkins job that clones the repository from github, then runs the powershell script that increments the version number in the file. I'm now trying to publish that update file back to the original repository on github, so when developer pulls the changes he gets the latest version number.

I tried using Git Publisher in the post build events, and I can publish tags with no issues, but it doesn't seem to publish any files.

Answer Source

Found an answer myself, this blog helped: http://thingsyoudidntknowaboutjenkins.tumblr.com/post/23596855946/git-plugin-part-3

Basically need to execute:

git checkout master

before modifying any files


git commit -am "Updated version number"

after modified files

and then use post build action of Git Publisher with an option of Merge Results which will push changes to github on successful build.