I'm looking to set up a Jenkins job that will publish a package to npmjs.com. The source code for the package is located in a GitHub repository.
While I am able to successfully publish the package from my personal computer by running 'npm publish' in the console, I encounter an error when attempting to do so through Jenkins.
This is the setup of my Jenkins job:
Specified path to the GitHub project
Added an 'Execute Windows batch command' with the following script:
git checkout master
git pull
npm publish
The output in the console looks like this:
C:\Program Files (x86)\Jenkins\workspace\js-agent-cucumber-release>git checkout master
Your branch is behind 'origin/master' by 2 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
Previous HEAD position was fbd7040 Update package.json
Switched to branch 'master'
C:\Program Files (x86)\Jenkins\workspace\js-agent-cucumber-release>git pull
Updating 27de403..fbd7040
Fast-forward
package.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[Remaining console output removed for brevity]
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
Is there anyone who has encountered this issue before and knows how to resolve it?