-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPublish-Release.ps1
More file actions
40 lines (34 loc) · 970 Bytes
/
Publish-Release.ps1
File metadata and controls
40 lines (34 loc) · 970 Bytes
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
param (
[Parameter(Mandatory=$true)][string]$apiKey,
[Parameter(Mandatory=$false)][bool]$RemovePrevNuPkg = $true
)
$branch = invoke-expression "git branch --show-current"
if ($branch -ne 'master') {
Write-Error "Publishing only allowed from master branch"
exit
}
$projPaths = @(
"./AMT.Extensions.Linq",
"./AMT.Extensions.Logging",
"./AMT.Extensions.System"
)
if ($RemovePrevNuPkg) {
Write-Verbose "Removing previous NuPkg files"
$projPaths | %{
write-host "" # separator
Remove-Item $_/bin/Release/*.nupkg -ErrorAction SilentlyContinue
}
}
# Ensure everything is built
Write-Verbose "Pack projects"
$projPaths | %{
write-host "" # separator
dotnet pack -c Release $_
}
# Publish to NuGet
Write-Verbose "Publish projects"
$projPaths | %{
write-host "" # separator
$pkg = gci $_/bin/Release *.nupkg
dotnet nuget push -k $apiKey $pkg.FullName -s https://api.nuget.org/v3/index.json
}