Skip to content

Commit

Permalink
Merge pull request #6 from Readify/versioning
Browse files Browse the repository at this point in the history
Added build script for module versioning
  • Loading branch information
kjacobsen authored Feb 5, 2020
2 parents fab81a6 + a8415e5 commit 5f37291
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions gitversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
mode: Mainline

0 comments on commit 5f37291

Please sign in to comment.