From e085ed08feb4dcdab105a52766011807d22b706b Mon Sep 17 00:00:00 2001 From: Alex Sarafian Date: Mon, 6 Feb 2017 13:25:36 +0100 Subject: [PATCH] Auto changelog to manifest (#10) * Publish scripts picks up automatically the release notes from the changelog.md * no message --- Automation/Publish-Module.ps1 | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/Automation/Publish-Module.ps1 b/Automation/Publish-Module.ps1 index cdb2929..1949e8e 100644 --- a/Automation/Publish-Module.ps1 +++ b/Automation/Publish-Module.ps1 @@ -29,6 +29,8 @@ param( [switch]$ISH13=$false #> ) +Set-StrictMode -Version latest + $moduleNamesToPublish=@() switch ($PSCmdlet.ParameterSetName) { @@ -52,14 +54,14 @@ if((& "$PSScriptRoot\Test-All.ps1") -ne 0) Write-Warning "Tests failed. Stopping..." return } - +$changeLogPath="$PSScriptRoot\..\CHANGELOG.md" +$changeLog=Get-Content -Path $changeLogPath if($publishDebug) { $revision=0 $date=(Get-Date).ToUniversalTime() $build=[string](1200 * ($date.Year -2015)+$date.Month*100+$date.Day) $build+=$date.ToString("HHmm") - $sourceVersion+=".$build.$revision" } @@ -164,6 +166,31 @@ foreach($moduleName in $moduleNamesToPublish) $psm1Name=$moduleName+".psm1" $psd1Path=Join-Path $modulePath "$moduleName.psd1" $guid="c1e7cbac-9e47-4906-8281-5f16471d7ccd" + + $possition = "None" + $releaseNotes=foreach ($line in $changelogContent) { + if ($line.StartsWith("**")){ + if($possition -eq "None"){ + $possition="This Version" + } + else + { + $possition="Next Version" + } + continue + } + If($possition -eq "This Version"){ + if($line) + { + $line + } + } + } + $releaseNotes+=@( + "" + "https://github.com/Sarafian/ISHServer/blob/master/CHANGELOG.md" + ) + $hash=@{ "Author"="SDL plc" "CompanyName" = "SDL plc" @@ -174,7 +201,7 @@ foreach($moduleName in $moduleNamesToPublish) "Path"=$psd1Path "LicenseUri"='https://github.com/Sarafian/ISHServer/blob/master/LICENSE' "ProjectUri"= 'https://github.com/Sarafian/ISHServer/' - "ReleaseNotes"= 'https://github.com/Sarafian/ISHServer/blob/master/CHANGELOG.md' + "ReleaseNotes"= $releaseNotes -join [System.Environment]::NewLine "CmdletsToExport" = $exportedNames "FunctionsToExport" = $exportedNames }