From 9a85702ed83f1ef3a2b67c086de85804177c5c0f Mon Sep 17 00:00:00 2001 From: Mark van Renswoude Date: Tue, 1 Oct 2019 10:27:48 +0200 Subject: [PATCH] Changed version number strategy to include CommitsSinceVersionSource --- build/UpdateVersion.ps1 | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/build/UpdateVersion.ps1 b/build/UpdateVersion.ps1 index bc64645..3cc1f7e 100644 --- a/build/UpdateVersion.ps1 +++ b/build/UpdateVersion.ps1 @@ -5,13 +5,21 @@ if (-not (Test-Path env:APPVEYOR_BUILD_FOLDER)) $env:APPVEYOR_BUILD_FOLDER = "P:\Tapeti" } -if (-not (Test-Path env:GitVersion_AssemblySemVer)) +if (-not (Test-Path env:GitVersion_MajorMinorPatch)) { - Write-Host "Warning: GitVersion_AssemblySemVer environment variable not set" - $env:GitVersion_AssemblySemVer = "2.0.0" + Write-Host "Warning: GitVersion_MajorMinorPatch environment variable not set" + $env:GitVersion_MajorMinorPatch = "0.0.1" } -Write-Host "Updating version to $($env:GitVersion_AssemblySemVer) for projects in $($env:APPVEYOR_BUILD_FOLDER)" +if (-not (Test-Path env:GitVersion_CommitsSinceVersionSource)) +{ + Write-Host "Warning: GitVersion_CommitsSinceVersionSource environment variable not set" + $env:GitVersion_CommitsSinceVersionSource = "42" +} + +$version = "$($env:GitVersion_MajorMinorPatch).$($env:GitVersion_CommitsSinceVersionSource)" + +Write-Host "Updating version to $($version) for projects in $($env:APPVEYOR_BUILD_FOLDER)" $projectFiles = Get-ChildItem $env:APPVEYOR_BUILD_FOLDER -Recurse *.csproj | Select -ExpandProperty FullName foreach ($projectFile in $projectFiles) @@ -19,7 +27,7 @@ foreach ($projectFile in $projectFiles) $contents = Get-Content -Path $projectFile if ($contents -match "(.+?)") { - $contents = $contents -replace "(.+?)", "$($env:GitVersion_AssemblySemVer)" + $contents = $contents -replace "(.+?)", "$($version)" Set-Content -Path $projectFile -Value $contents Write-Host "Updated $($projectFile)" }