mirror of
https://github.com/Sarsoo/IF.Lastfm.git
synced 2024-10-16 23:13:07 +01:00
Use version from Package-Versions.ps1 for SQLite package version
Closes #67
This commit is contained in:
parent
24d0c40f59
commit
ecbea890f9
1
.nuget/Package-Versions.ps1
Normal file
1
.nuget/Package-Versions.ps1
Normal file
@ -0,0 +1 @@
|
||||
$sqliteVersion = "0.2.0"
|
@ -2,33 +2,43 @@ param(
|
||||
[string] $versionSuffix
|
||||
)
|
||||
|
||||
. ".\Package-Versions.ps1"
|
||||
|
||||
$root = (split-path -parent $MyInvocation.MyCommand.Definition) + '\..'
|
||||
$version = [System.Reflection.AssemblyName]::GetAssemblyName($dllPath).Version
|
||||
|
||||
if ($versionSuffix) {
|
||||
$versionStr = "{0}.{1}.{2}-{3}" -f ($version.Major, $version.Minor, $version.Build, $versionSuffix)
|
||||
}
|
||||
else {
|
||||
$versionStr = $version.ToString()
|
||||
}
|
||||
|
||||
function CompileNuspec([string]$dllPath, [string]$nuspecname)
|
||||
{
|
||||
$version = [System.Reflection.Assembly]::LoadFile($dllPath).GetName().Version
|
||||
|
||||
if ($versionSuffix)
|
||||
{
|
||||
$versionStr = "{0}.{1}.{2}-{3}" -f ($version.Major, $version.Minor, $version.Build, $versionSuffix)
|
||||
}
|
||||
else
|
||||
{
|
||||
$versionStr = $version.ToString()
|
||||
}
|
||||
|
||||
Write-Host "Setting $nuspecname .nuspec version tag to $versionStr"
|
||||
Write-Host "Setting $nuspecname .nuspec version tag to $versionStr" -Foreground green
|
||||
|
||||
$content = (Get-Content $root\.nuget\$nuspecname.nuspec)
|
||||
$content = $content -replace '\$version',$versionStr
|
||||
|
||||
$content | Out-File $root\.nuget\$nuspecname.$versionStr.compiled.nuspec
|
||||
$content | Out-File "$root\.nuget\$nuspecname.$versionStr.compiled.nuspec"
|
||||
|
||||
& $root\.nuget\NuGet.exe pack $root\.nuget\$nuspecname.$versionStr.compiled.nuspec
|
||||
& $root\.nuget\NuGet.exe pack "$root\.nuget\$nuspecname.$versionStr.compiled.nuspec"
|
||||
}
|
||||
|
||||
CompileNuspec "$root\src\IF.Lastfm.Core\bin\Release\IF.Lastfm.Core.dll" "Inflatable.Lastfm"
|
||||
CompileNuspec "$root\src\IF.Lastfm.SQLite\bin\Release\IF.Lastfm.SQLite.dll" "Inflatable.Lastfm.SQLite"
|
||||
|
||||
if ([string]::IsNullOrEmpty($sqliteVersion)){
|
||||
Write-Host "Couldn't read version to use for SQLite package" -Foreground red
|
||||
}
|
||||
else {
|
||||
if ($versionStr.startswith($sqliteVersion)) {
|
||||
CompileNuspec "$root\src\IF.Lastfm.SQLite\bin\Release\IF.Lastfm.SQLite.dll" "Inflatable.Lastfm.SQLite"
|
||||
}
|
||||
else {
|
||||
Write-Host "Skipping SQLite package, build version is not $sqliteVersion" -Foreground yellow
|
||||
}
|
||||
}
|
||||
|
||||
# publish to appveyor feeds //TODO fix this
|
||||
# appveyor PushArtifact Inflatable.Lastfm.$versionStr.nupkg
|
||||
# appveyor PushArtifact Inflatable.Lastfm.$versionStr.nupkg
|
||||
|
Loading…
Reference in New Issue
Block a user