5252 [string ]
5353 $ReleaseType ,
5454
55+ # An optional release notice to include in the release
56+ [Parameter (
57+ Mandatory = $false
58+ )]
59+ [string ]
60+ $ReleaseNotice ,
61+
5562 # The branch this is being built from
5663 [Parameter (
5764 Mandatory = $true
@@ -139,7 +146,6 @@ $script:NuspecPath = Join-Path $script:NugetPackageDirectory "$ModuleName.nuspec
139146$script :GitHubRepoURI = " https://github.com/$GitHubRepoOwner /$GitHubRepoName "
140147$Script :BuiltModulePath = (Join-Path $global :BrownserveBuiltModuleDirectory - ChildPath " $ModuleName .psd1" )
141148$script :TrackedFiles = @ ()
142- $script :LineEndingFiles = @ ()
143149
144150<#
145151 Work out if this is a production release depending on the branch we're building from
@@ -381,6 +387,10 @@ task CreateChangelogEntry SetVersion, {
381387 RepositoryName = $GitHubRepoName
382388 ChangelogObject = $script :Changelog
383389 }
390+ if ($ReleaseNotice )
391+ {
392+ $NewChangelogEntryParams.Add (' Notice' , $ReleaseNotice )
393+ }
384394 if ($GitHubStageReleaseToken )
385395 {
386396 $NewChangelogEntryParams.Add (' Auto' , $true )
@@ -419,7 +429,6 @@ task UpdateChangelog CreateChangelogEntry, {
419429 {
420430 throw " Failed to update changelog. `n $ ( $_.Exception.Message ) "
421431 }
422- $script :LineEndingFiles += $script :ChangelogPath
423432 $script :TrackedFiles += ($script :ChangelogPath | Convert-Path )
424433}
425434
@@ -611,11 +620,6 @@ task UpdateModuleDocumentation ImportModule, {
611620 Resolve-Path to fail.
612621 #>
613622 $Script :ModulePagePath = Join-Path $Global :BrownserveRepoDocsDirectory " $ModuleName .md" | Resolve-Path
614- $script :LineEndingFiles += (Get-ChildItem `
615- - Path (Join-Path $Global :BrownserveRepoDocsDirectory - ChildPath $ModuleName ) `
616- - Filter * .md `
617- - Recurse | Select-Object - ExpandProperty ' FullName' )
618- $script :LineEndingFiles += (Get-Item - Path $Script :ModulePagePath )
619623}
620624
621625<#
@@ -684,33 +688,6 @@ task CompressModule CreateModuleHelp, {
684688 }
685689}
686690
687- <#
688- . SYNOPSIS
689- Ensures line endings for tracked files are set to 'LF'
690- . DESCRIPTION
691- PowerShell seems to insist on doing inconsistent things with line endings when running on different OSes.
692- This results in constant line ending change diffs in git which fails the build.
693- Therefore some files that are created as part of the build need to have their line endings set to 'LF' to ensure
694- consistency.
695-
696- !! This task has no dependencies as it should be run after all other tasks that may modify tracked files so be
697- !! careful with where you place it in the build.
698- #>
699- task SetLineEndings {
700- if ($script :LineEndingFiles.Count -gt 0 )
701- {
702- Write-Build White ' Ensuring line endings are consistent'
703- Set-LineEndings `
704- - Path $script :LineEndingFiles `
705- - LineEnding ' LF' `
706- - ErrorAction ' Stop'
707- }
708- else
709- {
710- Write-Warning ' No tracked files were specified for line ending checks'
711- }
712- }
713-
714691<#
715692. SYNOPSIS
716693 Creates a new branch for staging the release
@@ -746,7 +723,7 @@ task CreateStagingBranch SetVersion, {
746723 For example when we update the changelog or module documentation before a release.
747724 We want to commit those changes so they get included in the release. (and don't fail the build later on)
748725#>
749- task CommitTrackedChanges UpdateChangelog, UpdateModuleDocumentation, CreateStagingBranch, SetLineEndings , {
726+ task CommitTrackedChanges UpdateChangelog, UpdateModuleDocumentation, CreateStagingBranch, {
750727 $CommitMessage = " docs: Prepare for $script :PrefixedVersion `n`n This commit was automatically generated."
751728 if ($script :TrackedFiles.Count -gt 0 )
752729 {
@@ -986,7 +963,7 @@ task PublishRelease CheckPreviousReleases, CompressModule, Tests, PackNuGetPacka
986963 if (' PSGallery' -in $PublishTo )
987964 {
988965 Write-Build White ' Pushing to PSGallery'
989- <#
966+ <#
990967 For PSGallery the module needs to be in a directory named after itself... -_- (PowerShellGet is awful)
991968 2023-09-09: It gets EVEN MORE awful!
992969 It looks like PowerShellGet will automatically tag EVERY cmdlet which takes you over the 4000 NuGet character limit!!!
@@ -1020,7 +997,7 @@ task PublishRelease CheckPreviousReleases, CompressModule, Tests, PackNuGetPacka
1020997 $ReleaseParams.Add (' TargetCommit' , $script :CurrentCommitHash )
1021998 }
1022999 $ReleaseResponse = New-GitHubRelease @ReleaseParams
1023-
1000+
10241001 if ($script :CompressedModule )
10251002 {
10261003 Write-Build White ' Uploading compressed module as release asset'
@@ -1057,27 +1034,51 @@ task PublishRelease CheckPreviousReleases, CompressModule, Tests, PackNuGetPacka
10571034. SYNOPSIS
10581035 Meta task for building the module.
10591036. DESCRIPTION
1060- This task will run all the tasks required to build the module.
1061- This task is useful for local development as it allows you to import the module and test cmdlets etc.
1037+ This task will run all the tasks required to build just the module.
1038+ It doesn't build the documentation, NuGet package or perform any tests.
1039+ This task is mostly here just to serve as a base for other tasks.
1040+ #>
1041+ task Build UseWorkingCopy, CreateModuleManifest, {}
1042+
1043+ <#
1044+ . SYNOPSIS
1045+ Meta task for building the module and importing it.
1046+ . DESCRIPTION
1047+ This task will run all the tasks required to build the module and import it.
1048+ It does not build the documentation, NuGet package or perform any tests as these can take some time to complete.
1049+ This task is best used when developing new features locally as it allows you to quickly test your changes
1050+ interactively.
1051+ #>
1052+ task BuildAndImport Build, ImportModule, {}
1053+
1054+ <#
1055+ . SYNOPSIS
1056+ Meta task for building the module along with the documentation.
1057+ . DESCRIPTION
1058+ This task will run all the tasks required to build the module and generate the documentation.
1059+ The documentation can take some time to generate, especially as it currently requires us to run a separate process
1060+ to replace the line endings and format the markdown.
1061+ This task is best ran after any local changes have largely been finalised as it will generate any documentation
1062+ required.
10621063#>
1063- task Build UseWorkingCopy , CreateModuleManifest , UpdateModuleDocumentation , CreateModuleHelp, SetLineEndings , {}
1064+ task BuildWithDocs BuildAndImport , CreateModuleHelp, {}
10641065
10651066<#
10661067. SYNOPSIS
10671068 Meta task for building and testing the module.
10681069. DESCRIPTION
1069- This task will build the module and perform unit tests on it .
1070- This task is useful for completing more thorough testing of the module when developing locally .
1070+ This task performs the same actions as the previous tasks but also performs unit tests on the module .
1071+ This task is best used to thoroughly test any changes before committing them .
10711072#>
1072- task BuildAndTest Build , Tests, {}
1073+ task BuildAndTest BuildWithDocs , Tests, {}
10731074
10741075<#
10751076. SYNOPSIS
10761077 Meta task for building and testing the module, then finally confirming there are no uncommitted changes.
10771078. DESCRIPTION
10781079 This task will build the module, perform unit tests on it and then ensure there are no uncommitted changes
10791080 resulting from the build.
1080- This is the build we use for our pull_request CI pipeline.
1081+ This is the build we use for our pull_request CI pipeline and as such must pass before we can merge any changes .
10811082#>
10821083task BuildTestAndCheck BuildAndTest, CheckForUncommittedChanges, {}
10831084
@@ -1090,7 +1091,7 @@ task BuildTestAndCheck BuildAndTest, CheckForUncommittedChanges, {}
10901091 This allows us to review the changes and make any adjustments before we actually release them.
10911092 We use this task in the stage_release CI pipeline.
10921093#>
1093- task StageRelease CheckStagingParameters, UseWorkingCopy, CreateChangelogEntry, UpdateChangelog, UpdateModuleDocumentation, UpdateModulePageHelpVersion, SetLineEndings , CreatePullRequest, {
1094+ task StageRelease CheckStagingParameters, UseWorkingCopy, CreateChangelogEntry, UpdateChangelog, UpdateModuleDocumentation, UpdateModulePageHelpVersion, CreatePullRequest, {
10941095 $BuildMessage = @"
10951096The release has been successfully staged and a pull request has been created.
10961097Please review the changes at $script :PRLink and merge if they look good.
0 commit comments