Skip to content

Commit 1f8f39e

Browse files
committedApr 6, 2024
ci: Use Publish-PSResource to publish module to ensure dot-files are included in module package.
1 parent ef4e3ff commit 1f8f39e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed
 

‎.github/workflows/build-test-and-deploy-powershell-module.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,11 @@ jobs:
4747
Write-Output "Testing the prerelease module manifest file '$moduleManifestFilePath' to ensure it is still valid."
4848
Test-ModuleManifest -Path $moduleManifestFilePath
4949
50-
Write-Output "Publishing the prerelease version of the module."
50+
# Publish-Module has a bug where it does not include dot-files in the module when publishing, so must use Publish-PSResource instead.
51+
Write-Output "Installing the PSResourceGet module to use to publish the module."
5152
Install-Module -Name Microsoft.PowerShell.PSResourceGet -Scope CurrentUser -Repository PSGallery -Force
53+
54+
Write-Output "Publishing the prerelease version of the module."
5255
Publish-PSResource -Path $moduleDirectoryPath -ApiKey '${{ secrets.POWERSHELL_GALLERY_API_KEY }}' -Repository PSGallery -Verbose
5356
5457
- name: Wait a short while for the module to be available on the PowerShell Gallery before continuing
@@ -156,7 +159,13 @@ jobs:
156159
run: |
157160
[string] $moduleName = '${{ needs.run-build-and-test.outputs.powerShellModuleName }}'
158161
[string] $moduleDirectoryPath = "$Env:artifactsDirectoryPath/$moduleName"
159-
Publish-Module -Path $moduleDirectoryPath -NuGetApiKey '${{ secrets.POWERSHELL_GALLERY_API_KEY }}' -Verbose
162+
163+
# Publish-Module has a bug where it does not include dot-files in the module when publishing, so must use Publish-PSResource instead.
164+
Write-Output "Installing the PSResourceGet module to use to publish the module."
165+
Install-Module -Name Microsoft.PowerShell.PSResourceGet -Scope CurrentUser -Repository PSGallery -Force
166+
167+
Write-Output "Publishing the prerelease version of the module."
168+
Publish-PSResource -Path $moduleDirectoryPath -ApiKey '${{ secrets.POWERSHELL_GALLERY_API_KEY }}' -Repository PSGallery -Verbose
160169
161170
- name: Wait a short while for the module to be available on the PowerShell Gallery before continuing
162171
shell: pwsh

0 commit comments

Comments
 (0)
Please sign in to comment.