gaelcolas / Sampler

Module template with build pipeline and examples, including DSC elements.
MIT License
172 stars 42 forks source link

Tasks does not correctly add release notes when creating Nuget package or publish to private gallery #373

Closed johlju closed 2 years ago

johlju commented 2 years ago

Problem description

The tasks package_module_nupkg and publish_module_to_gallery has a bug that makes a private Nuget feed show an invalid release notes string.

Verbose logs

n/a

How to reproduce

Deploy a module to a private feed in Azure DevOps Server.

Expected behavior

Correctly show release notes.

Current behavior

Shows the invalid release notes, it outputs a hashtable instead of the release notes string.

@{RawData=## [0.2.0-integration] - 2022-05-20
### Added
- Some added stuff
### Fixed
- ...some fixex notes
; Date=05/20/2022 00:00:00; Version=0.2.0-integration; Link=; Data=}

Suggested solution

The code here: https://github.com/gaelcolas/Sampler/blob/41dd211b23884888bded75548367683237f3241e/.build/tasks/release.module.build.ps1#L222-L224

and here: https://github.com/gaelcolas/Sampler/blob/41dd211b23884888bded75548367683237f3241e/.build/tasks/release.module.build.ps1#L302-L304

Should be changed to:

$releaseNotesForLatestRelease = ($changeLogData.Released | Where-Object -FilterScript {
    $_.Version -eq $ModuleVersion
}).RawData

Operating system the target node is running

n/a

PowerShell version and build the target node is running

n/a

Module version used

v0.115.0-preview0001
johlju commented 2 years ago

Maybe we could remove using the property ReleaseNotes altogether on the command Publish-Module since we update the module manifest will the release notes, it should use it and we don't see the warning

WARNING: ReleaseNotes is now supported in the module manifest file (.psd1). Update the module manifest file of module 'PasswordState' in 'E:\Users\johlju\PasswordState\output\builtModule\PasswordState\0.3.0' with the newest ReleaseNotes changes. You can run Update-ModuleManifest -ReleaseNotes to update the manifest with ReleaseNotes.
johlju commented 2 years ago

Yep, that seem to work much better, could remove several lines of code.