Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added publish script.

  • Loading branch information...
commit 0f1162244166030b2041ec6774bfd0b4e1987f96 1 parent 11d91ee
@tathamoddie authored
Showing with 56 additions and 0 deletions.
  1. +9 −0 Publish-Release.cmd
  2. +47 −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
47 Publish-Release.ps1
@@ -0,0 +1,47 @@
+param (
+ [Parameter(Mandatory=$true)]
+ [ValidatePattern("\d\.\d\.\d\.\d")]
+ [string]
+ $ReleaseVersionNumber,
+
+ [switch]$Push
+)
+
+$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 "System.IO.Abstractions\System.IO.Abstractions.csproj"
+& nuget pack $ProjectPath -Prop Configuration=Release -OutputDirectory $SolutionRoot
+if (-not $?)
+{
+ throw "The NuGet process returned an error code."
+}
+
+$ProjectPath = Join-Path -Path $SolutionRoot -ChildPath "TestingHelpers\TestingHelpers.csproj"
+& nuget pack $ProjectPath -Prop Configuration=Release -OutputDirectory $SolutionRoot
+if (-not $?)
+{
+ throw "The NuGet process returned an error code."
+}
+
+# Upload the NuGet package
+if ($Push)
+{
+ $NuPkgPath = Join-Path -Path $SolutionRoot -ChildPath "System.IO.Abstractions.$ReleaseVersionNumber.nupkg"
+ & nuget push $NuPkgPath
+ if (-not $?)
+ {
+ throw "The NuGet process returned an error code."
+ }
+
+ $NuPkgPath = Join-Path -Path $SolutionRoot -ChildPath "System.IO.Abstractions.TestingHelpers.$ReleaseVersionNumber.nupkg"
+ & nuget push $NuPkgPath
+ if (-not $?)
+ {
+ throw "The NuGet process returned an error code."
+ }
+}
Please sign in to comment.
Something went wrong with that request. Please try again.