Skip to content

Commit

Permalink
Merge pull request #11 from bernarden/feature/increasing-version-number
Browse files Browse the repository at this point in the history
Increases version number to 0.2.0. Adds package publishing script.
  • Loading branch information
bernarden committed Mar 21, 2018
2 parents 3558b4a + 3f11e68 commit e642eeb
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 10 deletions.
56 changes: 56 additions & 0 deletions Scripts/PublishPackages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
$ErrorActionPreference = "Stop"
$PackagesDir = Join-Path -Path $PSScriptRoot -ChildPath "../Artifacts/Packages"
$NugetDir = Join-Path -Path $PSScriptRoot -ChildPath "../Temp/nuget.exe"

function Main {
$packages = Get-ChildItem -Path $PackagesDir
Write-Host "Following packages were found:" -ForegroundColor Yellow
Write-Host $packages -Separator "`n"

$result = Get-Approval-To-Execute
switch ($result) {
0 {
Write-Host "Continuing..." -ForegroundColor Yellow
Start-Sleep -s 10
Publish-Packages $packages
}

1 {
Write-Host "Exiting..." -ForegroundColor Yellow
}
}
}

function Get-Approval-To-Execute {
$title = "Publish Packages"
$message = "Are you sure you want to publish the packages listed above to nuget.org?"
$yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Packages will be published!"
$no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "Script execution will stop."
$options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
return $host.ui.PromptForChoice($title, $message, $options, 1)
}

function Publish-Packages {
param ( [System.Array] $Packages)

$nugetExeFile = Get-Item -Path $NugetDir

$symbolsPackagesPattern = ".*.symbols.nupkg"
$nugetPackagesPattern = ".*(?<!\.symbols)\.nupkg"

$symbolsPackages = $Packages | Where-Object {$_.Name -match $symbolsPackagesPattern}
foreach ($symbolsPackage in $symbolsPackages) {
Write-Host "Publishing $($symbolsPackage.Name)" -ForegroundColor Yellow
$args = @("push", $symbolsPackage.FullName, "-source", "https://nuget.smbsrc.net/")
& $nugetExeFile.FullName $args
}

$nugetPackages = $Packages | Where-Object {$_.Name -match $nugetPackagesPattern}
foreach ($nugetPackage in $nugetPackages) {
Write-Host "Publishing $($nugetPackage.Name)" -ForegroundColor Yellow
$args = @("push", $nugetPackage.FullName, "-source", "https://api.nuget.org/v3/index.json")
& $nugetExeFile.FullName $args
}
}

Main
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.1.0</Version>
<FileVersion>0.1.0</FileVersion>
<Version>0.2.0</Version>
<FileVersion>0.2.0</FileVersion>
<Authors>Victor Usoltsev</Authors>
<Description>Logging Abstractor is a library for .NET that allows you to swap out logging providers with ease.</Description>
<Copyright>Copyright © Victor Usoltsev 2018</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.1.0</Version>
<FileVersion>0.1.0</FileVersion>
<Version>0.2.0</Version>
<FileVersion>0.2.0</FileVersion>
<Authors>Victor Usoltsev</Authors>
<Description>Logging Abstractor is a library for .NET that allows you to swap out logging providers with ease.</Description>
<Copyright>Copyright © Victor Usoltsev 2018</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.1.0</Version>
<FileVersion>0.1.0</FileVersion>
<Version>0.2.0</Version>
<FileVersion>0.2.0</FileVersion>
<Authors>Victor Usoltsev</Authors>
<Description>Logging Abstractor is a library for .NET that allows you to swap out logging providers with ease.</Description>
<Copyright>Copyright © Victor Usoltsev 2018</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.1.0</Version>
<FileVersion>0.1.0</FileVersion>
<Version>0.2.0</Version>
<FileVersion>0.2.0</FileVersion>
<Authors>Victor Usoltsev</Authors>
<Description>Logging Abstractor is a library for .NET that allows you to swap out logging providers with ease.</Description>
<Copyright>Copyright © Victor Usoltsev 2018</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Version>0.1.0</Version>
<FileVersion>0.1.0</FileVersion>
<Version>0.2.0</Version>
<FileVersion>0.2.0</FileVersion>
<Authors>Victor Usoltsev</Authors>
<Description>Logging Abstractor is a library for .NET that allows you to swap out logging providers with ease.</Description>
<Copyright>Copyright © Victor Usoltsev 2018</Copyright>
Expand Down

0 comments on commit e642eeb

Please sign in to comment.