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