@@ -51,6 +51,27 @@ extends:
5151 runOnce :
5252 deploy :
5353 steps :
54+ - pwsh : |
55+ $artifactVersion = '$(resources.pipeline.officialBuildCI.runName)'
56+ $artifactBranchName = '$(resources.pipeline.officialBuildCI.sourceBranch)' -replace 'refs/heads/',''
57+
58+ # Set the BuildNumber in the form `# Publish prerelease v2.69.22 #` to improve readability in AzDO
59+ $buildNumberName = "Publish $artifactBranchName $artifactVersion"
60+ if ('${{ parameters.test }}' -eq 'true') {
61+ $buildNumberName = 'Test ' + $buildNumberName
62+ }
63+
64+ # Replace invalid characters
65+ $buildNumberName = $buildNumberName -replace '["/:<>\|?@*]','_'
66+ # Maximum buildnumber length is 255 chars and we are going to add a prefix and suffix so ensure we have space.
67+ if ($buildNumberName.Length -GT 252) {
68+ $buildNumberName = $buildNumberName.Substring(0, 252)
69+ }
70+ # Avoid ever ending the BuildNumber with a `.` by always appending to it.
71+ $buildNumberName = ' ' + $buildNumberName + ' #'
72+
73+ Write-Host "##vso[build.updatebuildnumber]$buildNumberName"
74+ displayName: Set BuildNumber
5475 - template : /azure-pipelines/install-node.yml@self
5576 - pwsh : |
5677 npm install --global @vscode/vsce
@@ -113,6 +134,7 @@ extends:
113134 Write-Host "##[command]vsce $publishArgs"
114135 vsce @publishArgs
115136 }
137+
116138 - stage : ' TagRelease'
117139 displayName : ' Tag release of vscode-csharp'
118140 dependsOn : ' PublishStage'
0 commit comments