Closed leojonathanoh closed 5 months ago
Invoke-PSModulePublisher.ps1
was designed for use in dev environments: https://github.com/theohbrothers/PSModulePublisher/blob/aa99891eac2de091060b8435fd23762163bb75e3/src/Invoke-PSModulePublisher.ps1#L2 It's meant to be executed without params with the fail-safe defaults.
CI environments on the other hand use the public scripts. The directory structure is a little more understandable with the recent changes.
as described in https://github.com/theohbrothers/PSModulePublisher/issues/25#issuecomment-1484485869 that there is a need for the user to be able to use Invoke-Test
, Invoke-Build
, and Invoke-Publish
independently, instead of Invoke-PSModulePublisher
which performs all three of them at once. Also discussed there is that it seems like the module is making correct progress with #26, #27, #28 which are making all three public functions.
The project actually isn't a PS module because it contains scripts and CI templates for use with it as well. It's possible to convert the scripts to functions. Will have to see if it's possible to do so without introducing too many breaking changes.
It is possible. I've checked that all the Invoke-Build
, Invoke-Test
, Invoke-Publish
cmdlets are not used by the default PS cmdlets.
the only difficulty i foresee are that the dot-sourcing in Invoke-Build.ps1
to Get-ProjectVariables.ps1
uses relative paths to PSModulePublisher
. If this becomes a PS module Import-Module; Invoke-Build
for instance, the Invoke-*
cmdlets must now be executed in the PS module's project dir to be able too resolve variables correctly (via private function Get-ProjectVariables
), in contrast to now where the Invoke-*
script may be called from anywhere.
i think making turning it into a module makes the project hard to understand, develop, and use in CI environments. it's more a compilation of scripts which now follow a modular format. the present design allows Invoke-PSModulePublisher.ps1
to be used which frees developer burden of needing to import the module etc.
true. basically a tools git submodule with a bunch of helpers. shouldn't need a PSGallery to Install Module; Import Module
in CI environments.
btw, pwsh
has become mainstream in at least Github CI, with first class citizen availability: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-powershell
so it's pretty easy to any of these in CI.
Install-Module PSModulePublisher ...
Import-Module PSModulePublisher -Force # May not be necessary, since Cmdlet might be loaded dynamically
Invoke-Build
# Must have git clone --recursive to clone submodules
Import-Module ./path/to/src/PSModulePublisher
Invoke-Build
# Must git clone --recursive to clone submodules
./path/to/src/Invoke-Build.ps1
just some little ideas.
How about the installation of publish dependencies, Pester, testing, and publishing of PS modules via actions as documented in the link. I'd assume it'd be pretty seamless. Code would be coupled and dependent on GHA though.
Reviewing things again, the approach https://github.com/theohbrothers/Generate-DockerImageVariants/pull/78 is the most elegant imo. The CI jobs do not execute the monolithic Invoke-PSModulePublisher.ps1
but only the scripts needed.
If Invoke-PSModulePublisher.ps1
would ever be used, it must support non-interactivity as suggested in OP.
If Invoke-PSModulePublisher.ps1 would ever be used, it must support non-interactivity as suggested in OP.
Will see if that can be supported.
Resolved in #46.
Closing.
Current
Invoke-PSModulePublisher.ps1
does not take paramsDiscussion
If
Invoke-PSModulePublisher.ps1
is to be used in the CI (as stated in the readme), it must be able to take params-Repository
andDryRun
.Right now, the script is a standalone script that is to be used interactively.