Only use semantic versioning when packaging NuGet

This commit is contained in:
Rikki Tooley 2014-11-21 00:01:39 +00:00
parent f5db4b37eb
commit 8246fcb609
2 changed files with 19 additions and 6 deletions

View File

@ -1,12 +1,24 @@
param(
[string] $versionSuffix
)
$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\..'
$version = [System.Reflection.Assembly]::LoadFile("$root\src\IF.Lastfm.Core\bin\Release\IF.Lastfm.Core.dll").GetName().Version
$versionStr = $version.ToString()
if ($versionSuffix)
{
$versionStr = "{0}.{1}.{2}-{3}" -f ($version.Major, $version.Minor, $version.Build, $versionSuffix)
}
else
{
$versionStr = $version.ToString()
}
Write-Host "Setting .nuspec version tag to $versionStr"
$content = (Get-Content $root\.nuget\IF.Lastfm.nuspec)
$content = $content -replace '\$version',$versionStr
$content | Out-File $root\.nuget\IF.Lastfm.compiled.nuspec
$content | Out-File $root\.nuget\IF.Lastfm.$versionStr.compiled.nuspec
& $root\.nuget\NuGet.exe pack $root\.nuget\IF.Lastfm.compiled.nuspec
& $root\.nuget\NuGet.exe pack $root\.nuget\IF.Lastfm.$versionStr.compiled.nuspec

View File

@ -3,7 +3,7 @@
only:
- master
version: 0.2.0.{build}-prerelease
version: 0.2.0.{build}
assembly_info:
patch: true
@ -21,12 +21,12 @@
project: IF.Lastfm.sln
after_test:
- ps: .nuget\pack.ps1
- ps: .nuget\pack.ps1 -versionSuffix prerelease
artifacts:
- path: src\IF.Lastfm.Core\bin\Release\IF.Lastfm.Core.dll
name: IF.Lastfm.Core.dll
- path: '**\*.nupkg'
- path: '**\*-prerelease.nupkg'
nuget:
project_feed: true
@ -36,6 +36,7 @@
only:
- release
# don't forget to update this!
version: 0.1.2.{build}
assembly_info: