Skip to content

Commit 7a5475a

Browse files
committed
feat(#177): update Publish.yml for module publishing process
- Add actions write permission - Include Import-BuiltCiModule script in the publishing workflow - Call Publish-NovaModule with PSGallery repository and API key
1 parent 5ec5e14 commit 7a5475a

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

scripts/build/ci/Import-BuiltCiModule.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,4 @@ if (-not (Test-Path -LiteralPath $moduleManifestPath)) {
1717
}
1818

1919
Remove-Module -Name $ProjectName -Force -ErrorAction SilentlyContinue
20-
return Import-Module -Name $moduleManifestPath -Force -PassThru -ErrorAction Stop
20+
return Import-Module -Name $moduleManifestPath -Force -Global -PassThru -ErrorAction Stop

tests/Module.Tests.ps1

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
BeforeAll {
22
$data = Get-NovaProjectInfo
3+
$script:repoRoot = Split-Path -Parent $PSScriptRoot
34
}
45

56
Describe 'General Module Control' {
@@ -25,4 +26,32 @@ Describe 'General Module Control' {
2526
$exportedCommandNameList | Should -Not -Contain 'Upload-NovaPackage'
2627
$exportedCommandNameList | Should -Not -Contain 'New-NovaModule'
2728
}
29+
30+
It 'Freshly importing the built module can run Update-NovaModuleVersion -WhatIf without missing private helpers' {
31+
Get-Module -Name $data.ProjectName -All | Remove-Module -Force -ErrorAction SilentlyContinue
32+
Import-Module -Name $data.OutputModuleDir -Force | Out-Null
33+
34+
$result = Update-NovaModuleVersion -Path $script:repoRoot -WhatIf
35+
36+
$result | Should -Not -BeNullOrEmpty
37+
$result.PSObject.Properties.Name | Should -Contain 'PreviousVersion'
38+
$result.PSObject.Properties.Name | Should -Contain 'NewVersion'
39+
$result.PSObject.Properties.Name | Should -Contain 'Label'
40+
$result.PSObject.Properties.Name | Should -Contain 'CommitCount'
41+
}
42+
43+
It 'Import-BuiltCiModule.ps1 loads the built module into the caller session for subsequent commands' {
44+
$helperPath = Join-Path $script:repoRoot 'scripts/build/ci/Import-BuiltCiModule.ps1'
45+
Get-Module -Name $data.ProjectName -All | Remove-Module -Force -ErrorAction SilentlyContinue
46+
47+
& $helperPath | Out-Null
48+
49+
$importedModule = Get-Module -Name $data.ProjectName -ErrorAction Stop
50+
(Split-Path -Parent $importedModule.Path) | Should -Be $data.OutputModuleDir
51+
52+
$result = Update-NovaModuleVersion -Path $script:repoRoot -WhatIf
53+
54+
$result | Should -Not -BeNullOrEmpty
55+
$result.PSObject.Properties.Name | Should -Contain 'NewVersion'
56+
}
2857
}

0 commit comments

Comments
 (0)