From ea3687387c6acb96b99b4074844608b4399e3ce9 Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 15:35:02 +0530 Subject: [PATCH 1/5] fixing stage conditions --- .azure-pipelines/azure-pipelines-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-release.yml b/.azure-pipelines/azure-pipelines-release.yml index 32d5186..20e158d 100644 --- a/.azure-pipelines/azure-pipelines-release.yml +++ b/.azure-pipelines/azure-pipelines-release.yml @@ -59,7 +59,6 @@ extends: - stage: Release displayName: Release to Latest trigger: manual - dependsOn: Build jobs: - job: Release displayName: Release to Latest From b7f8a79fe710cb3c335d3d0961580792b3477594 Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 16:04:23 +0530 Subject: [PATCH 2/5] adding dry-run for publish --- .azure-pipelines/azure-pipelines-release.yml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.azure-pipelines/azure-pipelines-release.yml b/.azure-pipelines/azure-pipelines-release.yml index 20e158d..63ea8ba 100644 --- a/.azure-pipelines/azure-pipelines-release.yml +++ b/.azure-pipelines/azure-pipelines-release.yml @@ -1,6 +1,13 @@ # Release Pipeline - Build, Test, and Release # This pipeline will be extended to the OneESPT template trigger: none + +parameters: +- name: dryRun + displayName: 'Dry Run (test publish without actually publishing)' + type: boolean + default: false + resources: repositories: - repository: 1ESPipelineTemplates @@ -31,7 +38,7 @@ extends: - job: PublishPrerelease displayName: Publish Prerelease dependsOn: BuildAndTest - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranchname'], 'master', 'ymlfix')) steps: - task: NodeTool@0 inputs: @@ -50,7 +57,7 @@ extends: displayName: Publish azure-devops-node-api to npm inputs: command: custom - customCommand: publish --tag prerelease + customCommand: publish --tag prerelease ${{ eq(parameters.dryRun, true) && '--dry-run' || '' }} workingDir: '_build' publishRegistry: useExternalRegistry customEndpoint: btt-npm-publish-token @@ -83,7 +90,7 @@ extends: displayName: Get package name and version - task: Npm@1 displayName: Remove prerelease tag for azure-devops-node-api in Npm - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'), eq('${{ parameters.dryRun }}', 'false')) inputs: command: custom customCommand: dist-tag remove "$(npm_package)" prerelease @@ -93,7 +100,7 @@ extends: publishEndpoint: btt-npm-publish-token - task: Npm@1 displayName: Add latest tag for azure-devops-node-api in Npm - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'), eq('${{ parameters.dryRun }}', 'false')) inputs: command: custom customCommand: dist-tag add "$(npm_package)" latest From 7b6b3eb5f465b982b067046ff71a3ea742c36adf Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 16:07:08 +0530 Subject: [PATCH 3/5] fixing syntax --- .azure-pipelines/azure-pipelines-release.yml | 32 ++++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.azure-pipelines/azure-pipelines-release.yml b/.azure-pipelines/azure-pipelines-release.yml index 63ea8ba..0c1ab5d 100644 --- a/.azure-pipelines/azure-pipelines-release.yml +++ b/.azure-pipelines/azure-pipelines-release.yml @@ -53,16 +53,28 @@ extends: displayName: npm install - script: npm run build displayName: npm run build - - task: Npm@1 - displayName: Publish azure-devops-node-api to npm - inputs: - command: custom - customCommand: publish --tag prerelease ${{ eq(parameters.dryRun, true) && '--dry-run' || '' }} - workingDir: '_build' - publishRegistry: useExternalRegistry - customEndpoint: btt-npm-publish-token - publishEndpoint: btt-npm-publish-token - continueOnError: true + - ${{ if eq(parameters.dryRun, true) }}: + - task: Npm@1 + displayName: Publish azure-devops-node-api to npm (dry run) + inputs: + command: custom + customCommand: publish --tag prerelease --dry-run + workingDir: '_build' + publishRegistry: useExternalRegistry + customEndpoint: btt-npm-publish-token + publishEndpoint: btt-npm-publish-token + continueOnError: true + - ${{ if eq(parameters.dryRun, false) }}: + - task: Npm@1 + displayName: Publish azure-devops-node-api to npm + inputs: + command: custom + customCommand: publish --tag prerelease + workingDir: '_build' + publishRegistry: useExternalRegistry + customEndpoint: btt-npm-publish-token + publishEndpoint: btt-npm-publish-token + continueOnError: true - stage: Release displayName: Release to Latest trigger: manual From d44dd1818215616be5d28eba98d25fb2c0850eab Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 16:25:40 +0530 Subject: [PATCH 4/5] adding logs --- .azure-pipelines/azure-pipelines-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.azure-pipelines/azure-pipelines-release.yml b/.azure-pipelines/azure-pipelines-release.yml index 0c1ab5d..8783a5c 100644 --- a/.azure-pipelines/azure-pipelines-release.yml +++ b/.azure-pipelines/azure-pipelines-release.yml @@ -97,6 +97,7 @@ extends: displayName: npm run build - bash: | package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"') + echo "Package name and version: $package_name" echo "##vso[task.setvariable variable=npm_package]$package_name" workingDirectory: '_build' displayName: Get package name and version From 51d34cb277d52df0b0d42dba3b2fe5a33a92eddf Mon Sep 17 00:00:00 2001 From: Tarun R <> Date: Fri, 1 Aug 2025 16:27:33 +0530 Subject: [PATCH 5/5] removing temp condition --- .azure-pipelines/azure-pipelines-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/azure-pipelines-release.yml b/.azure-pipelines/azure-pipelines-release.yml index 8783a5c..f1a7a6d 100644 --- a/.azure-pipelines/azure-pipelines-release.yml +++ b/.azure-pipelines/azure-pipelines-release.yml @@ -38,7 +38,7 @@ extends: - job: PublishPrerelease displayName: Publish Prerelease dependsOn: BuildAndTest - condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), in(variables['build.sourcebranchname'], 'master', 'ymlfix')) + condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master')) steps: - task: NodeTool@0 inputs: