-
Notifications
You must be signed in to change notification settings - Fork 0
/
Publish.ps1
50 lines (39 loc) · 2.52 KB
/
Publish.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
param
(
[Parameter()]
[Switch] $Preview
)
$productName = "Cornerstone"
$scriptPath = $PSScriptRoot
if ($scriptPath.Length -le 0)
{
$scriptPath = "C:\Workspaces\GitHub\$productName"
}
#$files = Get-Item "$scriptPath\Binaries\*.nupkg"
$file = [System.IO.FileInfo] "$scriptPath\Directory.Build.props"
$fileXml = [xml](Get-Content $file.FullName -Raw)
$version = $fileXml.Project.PropertyGroup.AssemblyVersion.ToString();
$files = @()
$projects = @("Cornerstone","Cornerstone.Automation","Cornerstone.Avalonia",
"Cornerstone.EntityFramework","Cornerstone.Newtonsoft","BobsToolbox.PowerShell",
"Cornerstone.Web"
)
foreach ($project in $projects)
{
$files += "$scriptPath\$project\bin\Release\$project.$version.nupkg"
}
foreach ($file in $files)
{
$fileInfo = [System.IO.FileInfo] $file
if ($Preview.IsPresent)
{
Write-host "& `"nuget.exe`" push $($fileInfo.FullName) -Source https://api.nuget.org/v3/index.json" -ForegroundColor Yellow
continue
}
Write-Host $fileInfo.FullName -ForegroundColor Cyan
& "nuget.exe" push $fileInfo.FullName -Source https://api.nuget.org/v3/index.json
if (Test-Path "C:\Workspaces\Nuget\Release")
{
Copy-Item $fileInfo.FullName "C:\Workspaces\Nuget\Release\$($fileInfo.Name)"
}
}