Skip to content

Commit 0894cfb

Browse files
Users/tarun/ymlfix (#648)
* fixing stage conditions * adding dry-run for publish * fixing syntax * adding logs * removing temp condition --------- Co-authored-by: Tarun R <>
1 parent a50b77a commit 0894cfb

File tree

1 file changed

+32
-13
lines changed

1 file changed

+32
-13
lines changed

.azure-pipelines/azure-pipelines-release.yml

Lines changed: 32 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
# Release Pipeline - Build, Test, and Release
22
# This pipeline will be extended to the OneESPT template
33
trigger: none
4+
5+
parameters:
6+
- name: dryRun
7+
displayName: 'Dry Run (test publish without actually publishing)'
8+
type: boolean
9+
default: false
10+
411
resources:
512
repositories:
613
- repository: 1ESPipelineTemplates
@@ -46,20 +53,31 @@ extends:
4653
displayName: npm install
4754
- script: npm run build
4855
displayName: npm run build
49-
- task: Npm@1
50-
displayName: Publish azure-devops-node-api to npm
51-
inputs:
52-
command: custom
53-
customCommand: publish --tag prerelease
54-
workingDir: '_build'
55-
publishRegistry: useExternalRegistry
56-
customEndpoint: btt-npm-publish-token
57-
publishEndpoint: btt-npm-publish-token
58-
continueOnError: true
56+
- ${{ if eq(parameters.dryRun, true) }}:
57+
- task: Npm@1
58+
displayName: Publish azure-devops-node-api to npm (dry run)
59+
inputs:
60+
command: custom
61+
customCommand: publish --tag prerelease --dry-run
62+
workingDir: '_build'
63+
publishRegistry: useExternalRegistry
64+
customEndpoint: btt-npm-publish-token
65+
publishEndpoint: btt-npm-publish-token
66+
continueOnError: true
67+
- ${{ if eq(parameters.dryRun, false) }}:
68+
- task: Npm@1
69+
displayName: Publish azure-devops-node-api to npm
70+
inputs:
71+
command: custom
72+
customCommand: publish --tag prerelease
73+
workingDir: '_build'
74+
publishRegistry: useExternalRegistry
75+
customEndpoint: btt-npm-publish-token
76+
publishEndpoint: btt-npm-publish-token
77+
continueOnError: true
5978
- stage: Release
6079
displayName: Release to Latest
6180
trigger: manual
62-
dependsOn: Build
6381
jobs:
6482
- job: Release
6583
displayName: Release to Latest
@@ -79,12 +97,13 @@ extends:
7997
displayName: npm run build
8098
- bash: |
8199
package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"')
100+
echo "Package name and version: $package_name"
82101
echo "##vso[task.setvariable variable=npm_package]$package_name"
83102
workingDirectory: '_build'
84103
displayName: Get package name and version
85104
- task: Npm@1
86105
displayName: Remove prerelease tag for azure-devops-node-api in Npm
87-
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
106+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'), eq('${{ parameters.dryRun }}', 'false'))
88107
inputs:
89108
command: custom
90109
customCommand: dist-tag remove "$(npm_package)" prerelease
@@ -94,7 +113,7 @@ extends:
94113
publishEndpoint: btt-npm-publish-token
95114
- task: Npm@1
96115
displayName: Add latest tag for azure-devops-node-api in Npm
97-
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
116+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'), eq('${{ parameters.dryRun }}', 'false'))
98117
inputs:
99118
command: custom
100119
customCommand: dist-tag add "$(npm_package)" latest

0 commit comments

Comments
 (0)