Skip to content

Commit

Permalink
add after build script example that shows how to automatically upload…
Browse files Browse the repository at this point in the history
… packages to myget which is useful for automated builds
  • Loading branch information
peters committed Oct 14, 2014
1 parent 4c7e4a6 commit bd56578
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
32 changes: 32 additions & 0 deletions afterbuild.example.ps1
Original file line number Diff line number Diff line change
@@ -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
}
7 changes: 7 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit bd56578

Please sign in to comment.