Skip to content

Commit 654875c

Browse files
committed
feat(#177): add Import-BuiltCiModule script for module import process
- implement parameter handling for repository root and project name - check for built module manifest existence before import - replace Install-CiPowerShellModules with Import-BuiltCiModule in Publish.yml
1 parent 88ba978 commit 654875c

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

.github/workflows/Publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ jobs:
8181
git checkout develop
8282
git reset --hard origin/main
8383
84-
./scripts/build/ci/Install-CiPowerShellModules.ps1
84+
./scripts/build/ci/Import-BuiltCiModule.ps1 | Out-Null
8585
8686
Update-NovaModuleVersion -Preview -Verbose
8787
@@ -100,7 +100,7 @@ jobs:
100100
Register-PSResourceRepository -PSGallery
101101
}
102102
103-
./scripts/build/ci/Install-CiPowerShellModules.ps1
103+
./scripts/build/ci/Import-BuiltCiModule.ps1 | Out-Null
104104
105105
Publish-NovaModule -Repository PSGallery -ApiKey $env:PSGALLERY_API
106106

project.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"ProjectName": "NovaModuleTools",
33
"Description": "NovaModuleTools is an enterprise-focused evolution of ModuleTools, designed for large-scale PowerShell projects with a strong emphasis on structure, maintainability, and automated CI/CD pipelines.",
4-
"Version": "2.0.0-preview96",
4+
"Version": "2.0.0-preview97",
55
"Preamble": [
66
"Set-StrictMode -Version Latest",
77
"$ErrorActionPreference = 'Stop'"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
param(
2+
[string]$RepositoryRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..' '..' '..')).Path,
3+
[string]$ProjectName
4+
)
5+
6+
Set-StrictMode -Version Latest
7+
$ErrorActionPreference = 'Stop'
8+
9+
if ( [string]::IsNullOrWhiteSpace($ProjectName)) {
10+
$projectJsonPath = Join-Path $RepositoryRoot 'project.json'
11+
$ProjectName = (Get-Content -LiteralPath $projectJsonPath -Raw | ConvertFrom-Json).ProjectName
12+
}
13+
14+
$moduleManifestPath = Join-Path $RepositoryRoot "dist/$ProjectName/$ProjectName.psd1"
15+
if (-not (Test-Path -LiteralPath $moduleManifestPath)) {
16+
throw "Built module manifest not found: $moduleManifestPath"
17+
}
18+
19+
Remove-Module -Name $ProjectName -Force -ErrorAction SilentlyContinue
20+
return Import-Module -Name $moduleManifestPath -Force -PassThru -ErrorAction Stop

0 commit comments

Comments
 (0)