我需要创建一个 jenkins 作业来将包发布到 npmjs.com。包源代码位于 github 存储库中。
我成功地从我的电脑上发布了包,在控制台中执行“npmpublish”命令,但使用 jenkins 时遇到错误。
这就是我在詹金斯工作中所做的:
指定github项目的路径。
添加了“执行 Windows 批处理命令”。剧本:
git checkout master
git pull
npm publish
Run Code Online (Sandbox Code Playgroud)
控制台输出:
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(-)
C:\Program Files (x86)\Jenkins\workspace\js-agent-cucumber-release>npm publish …Run Code Online (Sandbox Code Playgroud)