Skip to content

Commit ab53699

Browse files
Add the prerelease publishing step in the CI (#628)
* Add the prerelease publishing step in the CI Add the CI step for publishing a prerelease version of the package that can be manually invoked when needed * Add latest tag additionally * Fix typo working directory input for the bash task
1 parent 1d8f29c commit ab53699

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

azure-pipelines.yml

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,45 @@ extends:
6060
displayName: Publish azure-devops-node-api to npm
6161
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
6262
inputs:
63-
command: publish
63+
command: custom
64+
customCommand: publish --tag prerelease
6465
workingDir: '_build'
6566
publishRegistry: useExternalRegistry
6667
publishEndpoint: btt-npm-publish-token
6768
continueOnError: true
69+
- stage: Release
70+
displayName: Release to Latest
71+
trigger: manual
72+
jobs:
73+
- job: Release
74+
displayName: Release to Latest
75+
steps:
76+
- checkout: self
77+
clean: true
78+
- task: NodeTool@0
79+
inputs:
80+
versionSpec: $(versionSpec)
81+
displayName: Install node
82+
- bash: |
83+
package_name=$(npm pkg get name version | jq -r '"\(.name)@\(.version)"')
84+
echo "##vso[task.setvariable variable=npm_package]$package_name"
85+
workingDirectory: '_build'
86+
displayName: Get package name and version
87+
- task: Npm@1
88+
displayName: Remove prerelease tag for azure-devops-node-api in Npm
89+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
90+
inputs:
91+
command: custom
92+
customCommand: dist-tag remove "$(npm_package)" prerelease
93+
workingDir: '_build'
94+
publishRegistry: useExternalRegistry
95+
publishEndpoint: btt-npm-publish-token
96+
- task: Npm@1
97+
displayName: Add latest tag for azure-devops-node-api in Npm
98+
condition: and(succeeded(), in(variables['build.reason'], 'IndividualCI', 'BatchedCI', 'Manual'), eq(variables['build.sourcebranchname'], 'master'))
99+
inputs:
100+
command: custom
101+
customCommand: dist-tag add "$(npm_package)" latest
102+
workingDir: '_build'
103+
publishRegistry: useExternalRegistry
104+
publishEndpoint: btt-npm-publish-token

0 commit comments

Comments
 (0)