diff --git a/eng/pipelines/templates/stages/archetype-js-release.yml b/eng/pipelines/templates/stages/archetype-js-release.yml index 7a4c8f5510a7..5c76bf599131 100644 --- a/eng/pipelines/templates/stages/archetype-js-release.yml +++ b/eng/pipelines/templates/stages/archetype-js-release.yml @@ -85,7 +85,7 @@ stages: inputs: targetType: filePath filePath: "eng/tools/publish-to-npm.ps1" - arguments: '-pathToArtifacts $(Package.Archive) -accessLevel "public" -tag $env:Tag -additionalTag $env:AdditionalTag -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)' + arguments: '-pathToArtifacts $(Package.Archive) -accessLevel "public" -tag $(Tag) -additionalTag "$(AdditionalTag)" -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)' pwsh: true - ${{if ne(artifact.skipPublishDocMs, 'true')}}: diff --git a/eng/tools/publish-to-npm.ps1 b/eng/tools/publish-to-npm.ps1 index bcb9f84c0d34..66558001fb2f 100644 --- a/eng/tools/publish-to-npm.ps1 +++ b/eng/tools/publish-to-npm.ps1 @@ -1,7 +1,7 @@ param ( $pathToArtifacts, $accessLevel, - $tag="", + $tag, $additionalTag="", $registry, $npmToken, @@ -125,17 +125,8 @@ try { foreach ($p in $packageList) { if($p.Publish) { - if ($tag) - { - Write-Host "npm publish $($p.TarGz) --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag" - npm publish $p.TarGz --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag - } - else - { - Write-Host "npm publish $($p.TarGz) --access=$accessLevel --registry=$registry --always-auth=true" - npm publish $p.TarGz --access=$accessLevel --registry=$registry --always-auth=true - } - + Write-Host "npm publish $($p.TarGz) --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag" + npm publish $p.TarGz --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag if ($LastExitCode -ne 0) { Write-Host "npm publish failed with exit code $LastExitCode" exit 1