1- # param (
2- # [string] $version,
3- # [string] $preReleaseTag,
4- # [string] $apiKey
5- # )
1+ param (
2+ # [string]$version,
3+ # [string]$preReleaseTag,
4+ [Parameter (Mandatory = $false , HelpMessage = " Use this switch if you want to publish to PSGallery after the module has been prepared" )]
5+ [bool ]$Publish = $false ,
6+ [Parameter (Mandatory = $false , HelpMessage = " Write your API key for PSGallery" )]
7+ [string ]$apiKey
8+ )
69
710$Version = " 0.0.7"
811# $preReleaseTag = "-beta"
9- # $apiKey = "test"
1012$Year = (Get-Date ).Year
1113$ManifestDate = Get-Date - Format " yyyy-MM-dd"
1214
4547
4648# Adding the text from the filelicens.ps1 to the .psm1 file for licensing of GNU v3
4749$psmLicens = Get-Content - Path $psmLicensPath - ErrorAction SilentlyContinue
48- # $Results = [System.Management.Automation.Language.Parser]::ParseFile($psmLicens, [ref]$null, [ref]$null)
49- # $Functions = $Results.EndBlock.Extent.Text
5050$psmLicens | Add-Content - Path $outPSMFile
5151
5252# Collecting all .ps1 files that are located in src/function folders
@@ -97,9 +97,9 @@ $fileContent = $fileContent -replace '{{function}}', $FunctionPSD
9797Write-Verbose " Changing the placeholders in $ ( $outPSDFile ) "
9898Set-Content - Path $outPSDFile - Value $fileContent - Force
9999
100- Write-Output " ---/// $ ( $ModuleName ) is now prepared for publishing! ///--- "
101-
102- # Publish-Module `
103- # -Path $scriptPath\$ModuleName `
104- # -NuGetApiKey $apiKey `
105- # -Verbose -Force
100+ if ( $Publish -eq $true ) {
101+ Publish-Module - Path $ModuleFolderPath - NuGetApiKey $apiKey - Force
102+ }
103+ else {
104+ Write-Output " ---/// $ ( $ModuleName ) is now prepared for publishing! ///--- "
105+ }
0 commit comments