npm additional tag whitespace check (#29463)
bug fix: npm publishing with additional tag runs even with no additional tags being specified
This commit is contained in:
Родитель
c52b93c788
Коммит
91d2ea8e0d
|
@ -8,7 +8,7 @@ parameters:
|
|||
|
||||
steps:
|
||||
- template: /eng/common/pipelines/templates/steps/set-default-branch.yml
|
||||
- ${{if eq(parameters.Registry, 'https://registry.npmjs.org/')}}:
|
||||
- ${{ if eq(parameters.Registry, 'https://registry.npmjs.org/') }}:
|
||||
- task: EsrpRelease@6
|
||||
inputs:
|
||||
displayName: 'Publish ${{parameters.Artifact.name}} to ESRP'
|
||||
|
@ -22,16 +22,14 @@ steps:
|
|||
MainPublisher: 'ESRPRELPACMANTEST'
|
||||
DomainTenantId: '72f988bf-86f1-41af-91ab-2d7cd011db47'
|
||||
ProductStateField: ${{parameters.Tag}}
|
||||
|
||||
- ${{if ne(parameters.AdditionalTag, '')}}:
|
||||
- task: PowerShell@2
|
||||
displayName: Add Additional Tag
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: eng/tools/publish-to-npm.ps1
|
||||
arguments: -addTag $true -pathToArtifacts ${{parameters.PathToArtifacts}} -accessLevel "public" -tag "${{parameters.AdditionalTag}}" -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)
|
||||
pwsh: true
|
||||
condition: succeeded()
|
||||
- task: PowerShell@2
|
||||
displayName: Add Additional Tag
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: eng/tools/publish-to-npm.ps1
|
||||
arguments: -addTag $true -pathToArtifacts ${{parameters.PathToArtifacts}} -accessLevel "public" -tag "${{parameters.AdditionalTag}}" -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)
|
||||
pwsh: true
|
||||
condition: succeeded()
|
||||
|
||||
- ${{ else }}:
|
||||
- task: PowerShell@2
|
||||
|
|
|
@ -167,7 +167,9 @@ try {
|
|||
Write-Host "npm dist-tag add $nameAndVersion $tag"
|
||||
npm dist-tag add $nameAndVersion $tag
|
||||
}
|
||||
if ($additionalTag -ne "" && $additionalTag -ne $tag) {
|
||||
if (![string]::IsNullOrWhitespace($additionalTag) -and ($additionalTag -ne $tag)) {
|
||||
Write-Host "Tag: '$tag'"
|
||||
Write-Host "Additional tag: '$additionalTag'"
|
||||
Write-Host "Adding additional tag for package"
|
||||
Write-Host "npm dist-tag add $nameAndVersion $additionalTag"
|
||||
npm dist-tag add $nameAndVersion $additionalTag
|
||||
|
|
Загрузка…
Ссылка в новой задаче