Browse files

Added Publish-Release.ps1 script for building and uploading NuGet pac…

…kages.
  • Loading branch information...
1 parent 2209f9e commit b2888f34f28165a9f50ff5c167a08fab9322432c @tathamoddie committed Jul 14, 2011
Showing with 37 additions and 0 deletions.
  1. +9 −0 Publish-Release.cmd
  2. +28 −0 Publish-Release.ps1
View
9 Publish-Release.cmd
@@ -0,0 +1,9 @@
+@echo off
+setlocal
+set tempscript=%temp%\%~n0.%random%.ps1
+echo $ErrorActionPreference="Stop" >"%tempscript%"
+echo ^& "%~dpn0.ps1" %* >>"%tempscript%"
+powershell.exe -command "& \"%tempscript%\""
+set errlvl=%ERRORLEVEL%
+del "%tempscript%"
+exit /b %errlvl%
View
28 Publish-Release.ps1
@@ -0,0 +1,28 @@
+param (
+ [Parameter(Mandatory=$true)]
+ [ValidatePattern("\d\.\d\.\d\.\d")]
+ [string]
+ $ReleaseVersionNumber
+)
+
+$ErrorActionPreference = "Stop"
+
+$PSScriptFilePath = (Get-Item $MyInvocation.MyCommand.Path).FullName
+
+$SolutionRoot = Split-Path -Path $PSScriptFilePath -Parent
+
+# Build the NuGet package
+$ProjectPath = Join-Path -Path $SolutionRoot -ChildPath "SnowMaker\SnowMaker.csproj"
+& nuget pack $ProjectPath -Symbols -Prop Configuration=Release -OutputDirectory $SolutionRoot
+if (-not $?)
+{
+ throw "The NuGet process returned an error code."
+}
+
+# Upload the NuGet package
+$NuPkgPath = Join-Path -Path $SolutionRoot -ChildPath "SnowMaker.$ReleaseVersionNumber.nupkg"
+& nuget push $NuPkgPath
+if (-not $?)
+{
+ throw "The NuGet process returned an error code."
+}

0 comments on commit b2888f3

Please sign in to comment.