fix(build): publish from artefact path to include vendored deps#60
Merged
Conversation
- Remove New-ConfigurationPublish from Build-Module {} scriptblock; PSPublishModule
resolves -Name from PSModulePath (pre-vendoring) so PSWriteHTML/PSCertutil were absent
- Extract post-build logic into Build/Invoke-LS2PostBuildPublish.ps1 with
SupportsShouldProcess and full cbh; calls Publish-Module -Path \
- Update Build-Module.ps1 to dot-source and call Invoke-LS2PostBuildPublish after
Build-Module {} completes, ensuring vendored Modules\ tree is present at publish time
- Add Tests/Build/Build-Module.Tests.ps1 with 12 unit tests covering publish/no-publish,
api key vs file path, NestedModules patching, and Save-Module invocations
- Replace plain Write-Host strings in Invoke-LS2PostBuildPublish.ps1 with colored [i]/[>]/[+]/[x] indicators matching PSPublishModule output style - Print blank line before vendoring and publish sections for visual separation - [>] yellow for in-progress, [+] green for success, [x] red for errors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When publishing via
New-ConfigurationPublishinside theBuild-Module {}scriptblock, PSPublishModule callsPublish-Module -Name Locksmith2which resolves the module from$PSModulePath. That copy is written before the post-build vendoring step, soPSWriteHTMLandPSCertutilare never included in what gets uploaded to PSGallery.Solution
New-ConfigurationPublishfrom theBuild-Module {}scriptblock entirelyBuild/Invoke-LS2PostBuildPublish.ps1, a proper advanced function withSupportsShouldProcessand comment-based helpBuild-Module.ps1now dot-sources and callsInvoke-LS2PostBuildPublishafterBuild-Module {}completes, soPublish-Module -Path $artefactRootsees the fully vendoredModules\tree[i]/[>]/[+]/[x]output matching PSPublishModule's styleTests
Added
Tests/Build/Build-Module.Tests.ps1with 12 unit tests covering:Publish-Moduleis not called when-PublishToPSGalleryis absent-Path(not-Name) is passed toPublish-ModuleCI Impact
No changes to
publish.ymlrequired — the workflow already passes$env:PSGALLERY_API_KEYvia-PSGalleryAPIKeyandBuild-Module.ps1forwards it through.