Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 32 additions & 13 deletions .azure-pipelines/azure-pipelines-release.yml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -46,20 +53,31 @@ 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
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
dependsOn: Build
jobs:
- job: Release
displayName: Release to Latest
Expand All @@ -79,12 +97,13 @@ 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
- 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
Expand All @@ -94,7 +113,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
Expand Down