Skip to content

Commit 7c85991

Browse files
committed
πŸ‘·β€β™‚οΈ Publish script to PSGAllery
1 parent caedb41 commit 7c85991

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

β€ŽPublish-ToPSGallery.ps1β€Ž

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
2+
3+
$releaseNotes = $env:RELEASE_NOTES
4+
$moduleVersion = $env:Gitversion_SemVerId
5+
Write-Host "ModuleVersion: $moduleVersion"
6+
7+
$manifestPath = Resolve-Path -Path "*\*.psd1"
8+
Write-Host "Manifest Path: $manifestPath"
9+
10+
11+
Update-ModuleManifest -ReleaseNotes $releaseNotes -Path $manifestPath.Path -ModuleVersion $moduleVersion #-Verbose
12+
13+
$moduleFilePath = Resolve-Path -Path "*\*.psm1"
14+
Write-Host "Module File Path: $moduleFilePath"
15+
16+
$modulePath = Split-Path -Parent $moduleFilePath
17+
Write-Host "Module Path: $modulePath"
18+
19+
$module = $modulePath | Split-Path -leaf
20+
21+
$nuGetApiKey = $env:PSGallery_PAT
22+
23+
try {
24+
Publish-Module -Path $modulePath -NuGetApiKey $nuGetApiKey -ErrorAction Stop -Force
25+
Write-Host "Module: $module Version: $moduleVersion has been Published to the PowerShell Gallery!"
26+
} catch {
27+
throw $_
28+
}

0 commit comments

Comments
Β (0)