-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild-nuget.ps1
More file actions
67 lines (56 loc) · 1.43 KB
/
build-nuget.ps1
File metadata and controls
67 lines (56 loc) · 1.43 KB
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
63
64
65
66
67
$version = Get-Content ".\CHANGELOG.md" -First 1
$version = $version.Substring(2)
Clear-Host
Write-Output "Version is $version"
$ErrorActionPreference = "Stop"
Write-Output "Clear Output folder..."
if (Test-Path ".\Output")
{
Remove-Item ".\Output" -Confirm:$false -Recurse:$true
if ($LastExitCode -ne 0)
{
Write-Error "Fail."
Exit 1
}
}
Write-Output "Getting nuget..."
$nugetApp="$env:TEMP\nuget-packager\nuget.exe"
if (-not (Test-Path $nugetApp))
{
md "$env:TEMP\nuget-packager"
Write-Output "Downloading nuget..."
Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile "$nugetApp"
Unblock-File $nugetApp
}
Write-Output "Build Nuget"
& dotnet `
pack sources\FtpsServerLibrary\FtpsServerLibrary.csproj `
-c Release `
-o output\nuget-package `
/p:InformationalVersion=$version `
/p:VersionPrefix=$version `
/p:Version=$version `
/p:AssemblyVersion=$version `
/p:Configuration=Release
if ($LastExitCode -ne 0)
{
Write-Error "Fail."
Exit 1
}
Write-Output "Publish Nuget"
$nugetKeyFile="..\nuget-api-key.key"
if (-not (Test-Path $nugetKeyFile))
{
Write-Error "File $nugetKeyFile is missing!"
Exit 1
}
$nugetKey = Get-Content $nugetKeyFile -First 1
& dotnet nuget push output\nuget-package\Siarhei_Kuchuk.FtpsServerLibrary.$version.nupkg `
--api-key $nugetKey `
--source https://api.nuget.org/v3/index.json
if ($LastExitCode -ne 0)
{
Write-Error "Fail."
Exit 1
}
Write-Output "Success."