GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Tasks/PSModulePush.Task.ps1 at main · PoshCode/Tasks Expand file tree/ Copy pathPSModulePush.Task.ps1More file actions 56 lines (51 loc) · 2.16 KB / Copy pathPSModulePush.Task.ps1File metadata and controls56 lines (51 loc) · 2.16 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 Add-BuildTask PSModulePush { if ($BuildSystem -ne 'None' -and $BranchName -in "master","main" -and -not [string]::IsNullOrWhiteSpace($PSGalleryKey)) { # If the $PSGalleryUri is set, make sure that's where we publish.... if ($PSGalleryUri -and $Script:PSRepository) { $PackageSources = Get-PackageSource foreach($source in $PackageSources) { if ($source.Name -eq $Script:PSRepository -or $source.Location -eq $PSGalleryUri -or $source.PublishLocation -eq $PSGalleryPublishUri) { Unregister-PackageSource -Name $source.Name } } $source = @{ Name = $Script:PSRepository Force = $true Trusted = $True ForceBootstrap = $True } if (($PSRepository -eq "PSGallery")) { $source["ProviderName"] = "PowerShellGet" } else { if ($PSGalleryUri) { $source["Location"] = $PSGalleryUri } if ($PSGalleryPublishUri) { $source["PublishLocation"] = $PSGalleryPublishUri } } Register-PackageSource @source } $publishModuleSplat = @{ Path = $PSModuleOutputPath NuGetApiKey = $PSGalleryKey Verbose = $true Force = $true Repository = $Script:PSRepository ErrorAction = 'Stop' } "Files in module output:" Get-ChildItem $PSModuleOutputPath -Recurse -File | Select-Object -Expand FullName "Publishing [$PSModuleOutputPath] to [$Script:PSRepository]" Publish-Module @publishModuleSplat } else { Write-Warning ("Skipping publish: To publish, ensure that...`n" + "`t* You are in a known build system (Current: $BuildSystem)`n" + "`t* You are committing to the main branch (Current: $BranchName) `n" + "`t* The repository APIKey is defined in `$PSGalleryKey (Current: $(![string]::IsNullOrWhiteSpace($PSGalleryKey)))") } } Add-BuildTask PSGallery PSModulePush |
| You are visitor 01402520 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |