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) + '\..' $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 $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" Write-Host "Setting .nuspec version tag to $versionStr"
$content = (Get-Content $root\.nuget\IF.Lastfm.nuspec) $content = (Get-Content $root\.nuget\IF.Lastfm.nuspec)
$content = $content -replace '\$version',$versionStr $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: only:
- master - master
version: 0.2.0.{build}-prerelease version: 0.2.0.{build}
assembly_info: assembly_info:
patch: true patch: true
@ -21,12 +21,12 @@
project: IF.Lastfm.sln project: IF.Lastfm.sln
after_test: after_test:
- ps: .nuget\pack.ps1 - ps: .nuget\pack.ps1 -versionSuffix prerelease
artifacts: artifacts:
- path: src\IF.Lastfm.Core\bin\Release\IF.Lastfm.Core.dll - path: src\IF.Lastfm.Core\bin\Release\IF.Lastfm.Core.dll
name: IF.Lastfm.Core.dll name: IF.Lastfm.Core.dll
- path: '**\*.nupkg' - path: '**\*-prerelease.nupkg'
nuget: nuget:
project_feed: true project_feed: true
@ -36,6 +36,7 @@
only: only:
- release - release
# don't forget to update this!
version: 0.1.2.{build} version: 0.1.2.{build}
assembly_info: assembly_info: