From d628aecc95b7a75bc05a5b515c269900a523e846 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Tue, 5 Nov 2024 08:57:06 +0100 Subject: [PATCH 1/2] Add a step to the CI to publish the package to Azure DevOps Feed --- azure-pipelines-steps-node.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/azure-pipelines-steps-node.yml b/azure-pipelines-steps-node.yml index 331b16568..c5327ef0d 100644 --- a/azure-pipelines-steps-node.yml +++ b/azure-pipelines-steps-node.yml @@ -22,10 +22,18 @@ steps: # Only on Linux. For CI runs on master, automatically publish packages - ${{ if eq(parameters.os, 'Linux') }}: + - bash: | + cp -f ../.npmrc .npmrc + npm publish || true # Ignore publish failures, usually will happen because package already exists + rm -f .npmrc + displayName: (task-lib) Publish the package to Azure DevOps Feed + workingDirectory: node/_build + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master')) + - bash: | echo //registry.npmjs.org/:_authToken=\${NPM_TOKEN} > .npmrc npm publish || true # Ignore publish failures, usually will happen because package already exists - displayName: (task-lib) npm publish + displayName: (task-lib) Publish the package to npm workingDirectory: node/_build condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master')) env: From 33d562a907d472246e03b7e126f362f543e88cb1 Mon Sep 17 00:00:00 2001 From: Ivan Duplenskikh <115665590+ivanduplenskikh@users.noreply.github.com> Date: Tue, 5 Nov 2024 15:22:14 +0100 Subject: [PATCH 2/2] Test --- azure-pipelines-steps-node.yml | 29 +++++++++++++++++++---------- node/package-lock.json | 2 +- node/package.json | 2 +- 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/azure-pipelines-steps-node.yml b/azure-pipelines-steps-node.yml index c5327ef0d..467243cc8 100644 --- a/azure-pipelines-steps-node.yml +++ b/azure-pipelines-steps-node.yml @@ -12,23 +12,32 @@ steps: inputs: workingFile: .npmrc -- script: npm ci +- task: Npm@1 + inputs: + command: ci + customRegistry: useNpmrc + workingDir: node displayName: (task-lib) npm ci - workingDirectory: node -- script: npm test - workingDirectory: node +- task: Npm@1 + inputs: + command: custom + customCommand: test + customRegistry: useNpmrc + workingDir: node displayName: (task-lib) npm test # Only on Linux. For CI runs on master, automatically publish packages - ${{ if eq(parameters.os, 'Linux') }}: - - bash: | - cp -f ../.npmrc .npmrc - npm publish || true # Ignore publish failures, usually will happen because package already exists - rm -f .npmrc + - task: Npm@1 + inputs: + command: publish + verbose: true + customRegistry: useNpmrc + workingDir: node/_build + publishRegistry: 'useFeed' + publishFeed: 'c86767d8-af79-4303-a7e6-21da0ba435e2/2442ccb9-e127-4ec5-99e5-28dd29f92057' displayName: (task-lib) Publish the package to Azure DevOps Feed - workingDirectory: node/_build - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranch'], 'refs/heads/master')) - bash: | echo //registry.npmjs.org/:_authToken=\${NPM_TOKEN} > .npmrc diff --git a/node/package-lock.json b/node/package-lock.json index 01c3085b1..877121605 100644 --- a/node/package-lock.json +++ b/node/package-lock.json @@ -1,6 +1,6 @@ { "name": "azure-pipelines-task-lib", - "version": "4.17.3", + "version": "0.999.999", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/node/package.json b/node/package.json index 3073e290d..d62d14e54 100644 --- a/node/package.json +++ b/node/package.json @@ -1,6 +1,6 @@ { "name": "azure-pipelines-task-lib", - "version": "4.17.3", + "version": "0.999.999", "description": "Azure Pipelines Task SDK", "main": "./task.js", "typings": "./task.d.ts",