-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Arnaud Castaner
committed
Jun 1, 2017
1 parent
10befe9
commit a52f56f
Showing
1 changed file
with
15 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,35 @@ | ||
param([String]$key,[String]$version) | ||
|
||
function setProjectVersion([String]$project, [String]$version) { | ||
$fileName = ".\src\$project\project.json" | ||
$content = (Get-Content $fileName) -join "`n" | ConvertFrom-Json | ||
$content.version = $version | ||
$newContent = ConvertTo-Json -Depth 10 $content | ||
Set-Content $fileName $newContent | ||
$fileName = resolve-path ".\src\$project\$project.csproj" | ||
$content = [xml](Get-Content $fileName) | ||
$v = $content.CreateElement("Version") | ||
$v.set_InnerXML($version) | ||
$content.Project.PropertyGroup.AppendChild($v) | ||
$content.Save($fileName) | ||
} | ||
|
||
function publishProject([String]$project,[String]$version) { | ||
cd ".\src\$project" | ||
& dotnet pack -c Release | ||
if ($LastExitCode -ne 0) { | ||
throw "Error ($LastExitCode) during dotnet pack" | ||
} | ||
$file = Get-Item "bin\Release\*.$version.nupkg" | ||
nuget push $file.FullName $key -Source https://api.nuget.org/v3/index.json | ||
if ($LastExitCode -ne 0) { | ||
throw "Error ($LastExitCode) during nuget push" | ||
} | ||
cd ..\.. | ||
} | ||
|
||
if ($version -ne "") { | ||
setProjectVersion "Folke.Core" $version | ||
|
||
& dotnet restore | ||
if ($LastExitCode -ne 0) { | ||
throw "Error ($LastExitCode) during dotnet restore" | ||
} | ||
|
||
publishProject "Folke.Core" $version | ||
} |