@@ -9,10 +9,10 @@ schedules:
9
9
- feature/lsp_tools_host
10
10
11
11
parameters :
12
- - name : InsertTargetBranch
13
- displayName : Target branch
14
- type : string
15
- default : main
12
+ - name : InsertTargetBranch
13
+ displayName : Target branch
14
+ type : string
15
+ default : main
16
16
17
17
resources :
18
18
pipelines :
@@ -87,16 +87,23 @@ jobs:
87
87
$vsix = $_.FullName
88
88
$npmName = "@microsoft/csharp-vscode-extension.$os-$arch"
89
89
90
- Write-Host "##[group]Translating $os-$arch VSIX to NPM package $npmName"
91
- $packageStagingDir = "$(Agent.TempDirectory)/csharp/$os-$arch"
92
- New-Item -Type Directory -Path $packageStagingDir | Set-Location
93
- Spawn-Tool '7z' ('x', '-y', $vsix)
94
- Set-Content -Path package.json -Value "{`n `"description`": `"C# for Visual Studio Code ($os-$arch) as NPM package for insertion into the C# Dev Kit extension for testing.`"`n}"
95
- Spawn-Tool 'npm' ('pkg','set',"name=$npmName","version=$version",'publishConfig.registry=https://pkgs.dev.azure.com/devdiv/DevDiv/_packaging/vs-green/npm/registry/','repository.type=git','repository.url=https://devdiv.visualstudio.com/DevDiv/_git/vscode-csharp-next',"repository.commit=$(resources.pipeline.BlueCI.sourceCommit)")
96
- Get-Content -Path package.json
97
- Spawn-Tool 'npm' @('publish','--userconfig','$(Pipeline.Workspace)/.npmrc')
98
- $InsertNpmDependencies += "$npmName@$version "
99
- Write-Host "##[endgroup]"
90
+ $packageNameAndVersion = "$npmName@$version"
91
+ $InsertNpmDependencies += "$packageNameAndVersion "
92
+ & npm view $packageNameAndVersion --userconfig $(Pipeline.Workspace)/.npmrc
93
+ # If the command succeeded it means the package is already published, so we need to skip it.
94
+ if ($LASTEXITCODE -eq 0) {
95
+ Write-Host "$packageNameAndVersion is already published, skipping."
96
+ } else {
97
+ Write-Host "##[group]Translating $os-$arch VSIX to NPM package $npmName"
98
+ $packageStagingDir = "$(Agent.TempDirectory)/csharp/$os-$arch"
99
+ New-Item -Type Directory -Path $packageStagingDir | Set-Location
100
+ Spawn-Tool '7z' ('x', '-y', $vsix)
101
+ Set-Content -Path package.json -Value "{`n `"description`": `"C# for Visual Studio Code ($os-$arch) as NPM package for insertion into the C# Dev Kit extension for testing.`"`n}"
102
+ Spawn-Tool 'npm' ('pkg','set',"name=$npmName","version=$version",'publishConfig.registry=https://pkgs.dev.azure.com/devdiv/DevDiv/_packaging/vs-green/npm/registry/','repository.type=git','repository.url=https://devdiv.visualstudio.com/DevDiv/_git/vscode-csharp-next',"repository.commit=$(resources.pipeline.BlueCI.sourceCommit)")
103
+ Get-Content -Path package.json
104
+ Spawn-Tool 'npm' @('publish','--userconfig','$(Pipeline.Workspace)/.npmrc')
105
+ Write-Host "##[endgroup]"
106
+ }
100
107
}
101
108
}
102
109
0 commit comments