Skip to content

Commit 74a6162

Browse files
Make tag as optional (Azure#14427)
* Make tag as optional
1 parent f426d33 commit 74a6162

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

eng/pipelines/templates/stages/archetype-js-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ stages:
8585
inputs:
8686
targetType: filePath
8787
filePath: "eng/tools/publish-to-npm.ps1"
88-
arguments: '-pathToArtifacts $(Package.Archive) -accessLevel "public" -tag $(Tag) -additionalTag "$(AdditionalTag)" -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)'
88+
arguments: '-pathToArtifacts $(Package.Archive) -accessLevel "public" -tag $env:Tag -additionalTag $env:AdditionalTag -registry ${{parameters.Registry}} -npmToken $(azure-sdk-npm-token)'
8989
pwsh: true
9090

9191
- ${{if ne(artifact.skipPublishDocMs, 'true')}}:

eng/tools/publish-to-npm.ps1

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
param (
22
$pathToArtifacts,
33
$accessLevel,
4-
$tag,
4+
$tag="",
55
$additionalTag="",
66
$registry,
77
$npmToken,
@@ -124,8 +124,17 @@ try {
124124

125125
foreach ($p in $packageList) {
126126
if($p.Publish) {
127-
Write-Host "npm publish $($p.TarGz) --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag"
128-
npm publish $p.TarGz --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag
127+
if ($tag)
128+
{
129+
Write-Host "npm publish $($p.TarGz) --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag"
130+
npm publish $p.TarGz --access=$accessLevel --registry=$registry --always-auth=true --tag=$tag
131+
}
132+
else
133+
{
134+
Write-Host "npm publish $($p.TarGz) --access=$accessLevel --registry=$registry --always-auth=true"
135+
npm publish $p.TarGz --access=$accessLevel --registry=$registry --always-auth=true
136+
}
137+
129138
if ($LastExitCode -ne 0) {
130139
Write-Host "npm publish failed with exit code $LastExitCode"
131140
exit 1

0 commit comments

Comments
 (0)