Last active
April 5, 2018 14:08
-
-
Save lfalck/aa84f635c5d5879f5888dc3c18efbbb3 to your computer and use it in GitHub Desktop.
This file contains 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
# Script to publish binary modules to Powershell Gallery based on Publish-ToPowerShellGallery.ps1 from https://github.com/mmaitre314/PowerShellGet-Test-Binary-Module | |
$manifestFilename = Get-ChildItem -Path $PSScriptRoot -Filter *.psd1 | Select-Object -First 1 -ExpandProperty Name | |
$manifestPath = Join-Path $PSScriptRoot $manifestFilename | |
$manifestData = Test-ModuleManifest -Path $manifestPath | |
Write-Host "Module version needs to be incremented before publishing. Current version is $($manifestData.Version)" | |
Update-ModuleManifest -Path $manifestPath -CmdletsToExport '*' -ModuleVersion (Read-Host "New module version: ") | |
Write-Host "Preparing module" | |
$binPath = Join-Path $PSScriptRoot "bin\Release" | |
$tempPath = Join-Path $env:TEMP $manifestData.Name | |
New-Item $tempPath -ItemType Directory -Force | Out-Null | |
Copy-Item (Join-Path $binPath "*.dll") $tempPath | |
Copy-Item (Join-Path $PSScriptRoot $manifestFilename) (Join-Path $tempPath $manifestFilename) | |
Write-Host "Publishing module" | |
Publish-Module -Path $modulePath -Repository PSGallery -NuGetApiKey (Read-Host "NuGetApiKey (from https://powershellgallery.com/account): ") | |
Remove-Item $tempPath -Force -Recurse |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment