Sandy
Sandy

Reputation: 2613

Publish npm from jenkins

I am new to jenkins. I want to know what is equivalent of "npm publish --registry..." in Jenkins.

I have configured Artifactory plugin in Jenkins, but I don't know how to use that in my job.

When I do npm publish manually it automatically creates .tgz file with correct version number and add it to Artifactory.

How can I accomplish the same?

Upvotes: 4

Views: 10899

Answers (2)

saxzez
saxzez

Reputation: 132

You can use the jfrog command line interface for this: https://www.jfrog.com/confluence/display/CLI/CLI+for+JFrog+Artifactory#CLIforJFrogArtifactory-BuildingNpmPackages

Just use jfrog rt npm-publish in place of npm publish and jfrog cli will take care of the rest.

Upvotes: 1

VonC
VonC

Reputation: 1323963

The Jenkins Artifactory plugin allows you to define the Artifactory server.

There is a deploy maven artifact section, but you could also simply consider a basic build step as an "Execute Windows batch command" or an "Execute shell" (for Linux), in which you can type the same command as the one you are typing manually.

You only need to make sure the environment variables used during that step by the account running Jenkins are the same as the account you are using when typing said command.

Upvotes: 1

Related Questions