fix(pwsh): publish module without irrelevant files

This commit is contained in:
Jan De Dobbeleer 2021-11-28 19:04:23 +01:00 committed by Jan De Dobbeleer
parent 64a9e65e74
commit 603c4da30b
5 changed files with 42 additions and 24 deletions

View file

@ -0,0 +1,27 @@
Param
(
[parameter(Mandatory=$true)]
[string]
$ModuleVersion,
[parameter(Mandatory=$true)]
[string]
$Repository,
[parameter(Mandatory=$false)]
[string]
$RepositoryAPIKey
)
$moduleDir = "./oh-my-posh"
New-Item -Path $moduleDir -ItemType Directory
# set the actual version number
(Get-Content './oh-my-posh.psd1' -Raw).Replace('0.0.0.1', $ModuleVersion) | Out-File -Encoding 'UTF8' "$moduleDir/oh-my-posh.psd1"
Copy-Item "./oh-my-posh.psm1" -Destination $moduleDir
Push-Location -Path $moduleDir
# publish the module
if ($RepositoryAPIKey) {
Publish-Module -Path . -Repository $Repository -NuGetApiKey $RepositoryAPIKey -Verbose
} else {
Publish-Module -Path . -Repository $Repository -Verbose
}
Pop-Location
Remove-Item -Path $moduleDir -Force -Recurse

View file

@ -1,24 +0,0 @@
Param
(
[parameter(Mandatory=$true)]
[string]
$ModuleVersion,
[parameter(Mandatory=$true)]
[string]
$Repository,
[parameter(Mandatory=$false)]
[string]
$RepositoryAPIKey
)
# set the actual version number
(Get-Content '.\oh-my-posh.psd1' -Raw).Replace('0.0.0.1', $ModuleVersion) | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1'
# publish the module
$exclude = @('README.md','deploy.ps1')
if ($RepositoryAPIKey) {
Publish-Module -Path . -Repository $Repository -NuGetApiKey $RepositoryAPIKey -Exclude $exclude -Verbose
} else {
Publish-Module -Path . -Repository $Repository -Exclude $exclude -Verbose
}
# reset module version (for local testing only as we don't want PR's with changed version numbers all the time)
(Get-Content '.\oh-my-posh.psd1' -Raw).Replace($ModuleVersion, '0.0.0.1') | Out-File -Encoding 'UTF8' '.\oh-my-posh.psd1'