-
Notifications
You must be signed in to change notification settings - Fork 367
/
PublishVSCodeExtension.ps1
62 lines (55 loc) · 1.86 KB
/
PublishVSCodeExtension.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[CmdletBinding(PositionalBinding = $false)]
param (
[string]$artifactsPath,
[string[]]$vscodeTargets,
[string]$vscodeToken,
[string]$nugetToken,
[switch]$simulate
)
Set-StrictMode -version 2.0
$ErrorActionPreference = "Stop"
try {
npm install -g vsce
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
$vscodeTargets | ForEach-Object {
$vscodeTarget = $_
# find extension vsix
$extension = Get-ChildItem "$artifactsPath\vscode\$vscodeTarget\dotnet-interactive-vscode-*.vsix" | Select-Object -First 1
# verify
if (-Not $simulate) {
. "$PSScriptRoot\VerifyVSCodeExtension.ps1" -extensionPath $extension
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
# publish nuget
if ($vscodeTarget -eq "stable") {
Get-ChildItem "$artifactsPath\packages\Shipping\Microsoft.DotNet*.nupkg" | ForEach-Object {
$nugetPackagePath = $_.ToString()
# don't publish asp or netstandard packages
if (-Not ($nugetPackagePath -match "(CSharpProject|Netstandard20)")) {
Write-Host "Publishing $nugetPackagePath"
if (-Not $simulate) {
dotnet nuget push $nugetPackagePath --source https://api.nuget.org/v3/index.json --api-key $nugetToken --no-symbols
if ($LASTEXITCODE -ne 0) {
exit $LASTEXITCODE
}
}
}
}
}
# publish vs code marketplace
Write-Host "Publishing $extension"
if (-Not $simulate) {
vsce publish --packagePath $extension --pat $vscodeToken --noVerify
}
}
}
catch {
Write-Host $_
Write-Host $_.Exception
Write-Host $_.ScriptStackTrace
exit 1
}