diff --git a/afterbuild.example.ps1 b/afterbuild.example.ps1 new file mode 100644 index 000000000..a862e42d9 --- /dev/null +++ b/afterbuild.example.ps1 @@ -0,0 +1,32 @@ +param( + [Parameter(Position = 0, Mandatory = $true)] + [string] $Version +) + +$WorkingDir = Split-Path -Parent $MyInvocation.MyCommand.Definition +$Nuget = Join-Path $env:LOCALAPPDATA .\nuget\NuGet.exe +$PackagePath = Join-Path $WorkingDir\nuget + +function Write-Diagnostic +{ + param( + [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] + [string] $Message + ) + + Write-Host + Write-Host $Message -ForegroundColor Green + Write-Host +} + +Write-Diagnostic "Uploading packages to myget" + +$Packages = @( + "$PackagePath\CefSharp.Common.$Version.nupkg", + "$PackagePath\CefSharp.WinForms.$Version.nupkg", + "$PackagePath\CefSharp.Wpf.$Version.nupkg" +) + +$Packages | ForEach-Object { + . $Nuget push $_ -Source https://myget.org/F/X +} \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 4db0a8523..d1121d51c 100644 --- a/build.ps1 +++ b/build.ps1 @@ -222,6 +222,13 @@ function Nupkg . $nuget pack nuget\CefSharp.Common.nuspec -NoPackageAnalysis -Version $Version -OutputDirectory nuget -Properties "RedistVersion=$RedistVersion" . $nuget pack nuget\CefSharp.Wpf.nuspec -NoPackageAnalysis -Version $Version -OutputDirectory nuget . $nuget pack nuget\CefSharp.WinForms.nuspec -NoPackageAnalysis -Version $Version -OutputDirectory nuget + + # Invoke `AfterBuild` script if available (ie. upload packages to myget) + if(-not (Test-Path $WorkingDir\AfterBuild.ps1)) { + return + } + + . $WorkingDir\AfterBuild.ps1 -Version $Version } function DownloadNuget()