Publish NPM package with Azure DevOps Pipeline task: ArtifactoryNpm@2 to Artifactory

2k views Asked by At

I am working on a large project. I need to publish several Angular libraries whose code is in Azure DevOps to JFrog Artifactory.

From previous developers, I found the task: ArtifactoryNpm@2 command in pipeline YAML file, which publishes a package to JFROG using command: 'pack and publish'. This works if you need to package and publish from the root directory. In Angular, libraries are created in the subdirectory projects/library-name, which breaks the behavior I want.

My attempts to link to folder or a .tgz file like command:

'publish $(Build.SourcesDirectory)/projects/library-name' were also unsuccessful.

I have asked the developers for a detailed description of this task, but did not find any help from them.

Link here https://github.com/jfrog/artifactory-azure-devops-extension/issues/209

If you've had a similar experience, let me know how you resolved this issue.

1

There are 1 answers

2
Cece Dong - MSFT On BEST ANSWER

You can check the json file in source code of this task in the following link:

https://github.com/jfrog/artifactory-azure-devops-extension/blob/master/tasks/ArtifactoryNpm/Ver2/task.json

There is an argument named workingFolder, which path to the folder containing the target package.json and .npmrc files. Select the folder, not the file e.g. /packages/mypackage. You can add workingFolder argument in your YAML file.