From a8415e5c29b3e41b95fa629bdb2dc1a2a52ff2c6 Mon Sep 17 00:00:00 2001 From: Robert McLeod Date: Sat, 1 Feb 2020 21:11:06 +1100 Subject: [PATCH] Added build script for module versioning --- build.ps1 | 18 ++++++++++++++++++ gitversion.yml | 1 + 2 files changed, 19 insertions(+) create mode 100644 build.ps1 create mode 100644 gitversion.yml diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..247a61b --- /dev/null +++ b/build.ps1 @@ -0,0 +1,18 @@ +[CMDletBinding()] +Param() + +if ((Get-Command -Name 'gitversion' -ErrorAction 'SilentlyContinue' | Measure-Object).Count -eq 0) { + throw 'gitversion must be installed' +} + +$version = gitversion | ConvertFrom-Json +$versionString = $version.NuGetVersion +Write-Information -MessageData "Calculated Module Version: $versionString" + +$rawManifest = Get-Content -Path "$PSScriptRoot/PwshZendesk.psd1" -raw +Write-Debug -Message "Raw Manifest:`n$rawManifest" + +$updatedManifest = $rawManifest -replace "ModuleVersion\s*=\s*['`"][0-9.]+['`"]", "ModuleVersion = '$versionString'" +Write-Debug -Message "Updated Manifest:`n$updatedManifest" + +$updatedManifest | Out-File -Path "$PSScriptRoot/PwshZendesk.psd1" -NoNewline diff --git a/gitversion.yml b/gitversion.yml new file mode 100644 index 0000000..c311488 --- /dev/null +++ b/gitversion.yml @@ -0,0 +1 @@ +mode: Mainline \ No newline at end of file