Skip to content

Commit 973777a

Browse files
committed
Fix publish warnings
1 parent eedc9f3 commit 973777a

File tree

5 files changed

+152
-7
lines changed

5 files changed

+152
-7
lines changed

.github/workflows/publish.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,16 @@ jobs:
5656
Update-ModuleManifest -Path $manifestPath -ReleaseNotes $releaseNotes
5757
Write-Host "Release notes for version '$moduleVersion' loaded from CHANGELOG.md."
5858
59+
- name: Prepare Publish Layout
60+
id: prepare_publish
61+
shell: pwsh
62+
run: |
63+
$publishPath = .\tools\prepare-publish.ps1 `
64+
-SourcePath . `
65+
-OutputPath (Join-Path $env:RUNNER_TEMP 'git-aliases-extra-publish')
66+
67+
"publish_path=$publishPath" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
68+
5969
- name: Publish to PSGallery
6070
shell: pwsh
6171
env:
@@ -65,7 +75,9 @@ jobs:
6575
throw "PSGALLERY_API_KEY secret is not set."
6676
}
6777
68-
$manifest = Test-ModuleManifest -Path .\git-aliases-extra.psd1 -ErrorAction Stop
78+
$publishPath = '${{ steps.prepare_publish.outputs.publish_path }}'
79+
$stagedManifestPath = Join-Path $publishPath 'git-aliases-extra.psd1'
80+
$manifest = Test-ModuleManifest -Path $stagedManifestPath -ErrorAction Stop
6981
$moduleName = $manifest.Name
7082
$moduleVersion = $manifest.Version.ToString()
7183
@@ -77,4 +89,4 @@ jobs:
7789
exit 0
7890
}
7991
80-
Publish-Module -Path . -Repository PSGallery -NuGetApiKey $env:PSGALLERY_API_KEY -Verbose
92+
Publish-Module -Path $publishPath -Repository PSGallery -NuGetApiKey $env:PSGALLERY_API_KEY -ErrorAction Stop

CHANGELOG.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,29 @@ All notable changes to this project are documented in this file.
44

55
The format is based on Keep a Changelog and the project uses Semantic Versioning.
66

7+
## [0.1.1] - 2026-02-19
8+
9+
### Added
10+
11+
- Publish staging script `tools/prepare-publish.ps1` to package runtime files only.
12+
- Automated release-notes extraction from `CHANGELOG.md` via `tools/get-release-notes.ps1`.
13+
- Additional module tests for publish layout and manifest dependency metadata.
14+
15+
### Changed
16+
17+
- Pinned `RequiredModules` to explicit versions:
18+
- `posh-git` `1.1.0`
19+
- `git-aliases` `0.3.8`
20+
- Updated publish workflow to:
21+
- run lint + tests before publish;
22+
- inject release notes from changelog;
23+
- publish from staged runtime-only layout.
24+
25+
### Fixed
26+
27+
- Removed `ExternalModuleDependencies` to avoid dependency-skip warnings during publish.
28+
- Reduced NuGet packaging noise by excluding repo-only content (`tests`, CI files, helper scripts) from publish artifact.
29+
730
## [0.1.0] - 2026-02-19
831

932
### Added

git-aliases-extra.psd1

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,16 @@
5050
AliasesToExport = @('gum', 'gur', 'gh')
5151
CmdletsToExport = @()
5252
VariablesToExport = '*'
53-
RequiredModules = @('posh-git', 'git-aliases')
53+
RequiredModules = @(
54+
@{
55+
ModuleName = 'posh-git'
56+
ModuleVersion = '1.1.0'
57+
},
58+
@{
59+
ModuleName = 'git-aliases'
60+
ModuleVersion = '0.3.8'
61+
}
62+
)
5463
PrivateData = @{
5564
PSData = @{
5665
Tags = @('git', 'aliases', 'completion', 'posh-git', 'powershell', 'worktree')
@@ -59,7 +68,6 @@
5968
IconUri = 'https://raw.githubusercontent.com/PhysShell/git-aliases-extra/main/assets/icon.png'
6069
RepositorySourceLocation = 'https://github.com/PhysShell/git-aliases-extra'
6170
ReleaseNotes = 'See CHANGELOG.md for release notes.'
62-
ExternalModuleDependencies = @('posh-git', 'git-aliases')
6371
RequireLicenseAcceptance = $false
6472
}
6573
}

tests/git-aliases-extra.Module.Tests.ps1

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,18 @@ Describe 'git-aliases-extra manifest' {
2929
$manifest.PrivateData.PSData.LicenseUri | Should -Match '/LICENSE$'
3030
$manifest.PrivateData.PSData.IconUri | Should -Match '/assets/icon\.png$'
3131
$manifest.PrivateData.PSData.ReleaseNotes | Should -Not -BeNullOrEmpty
32+
$manifest.PrivateData.PSData.ContainsKey('ExternalModuleDependencies') | Should -BeFalse
3233
$manifest.Copyright | Should -Match '\b\d{4}\b'
3334

34-
$requiredModuleNames = @($manifest.RequiredModules | ForEach-Object {
35-
if ($_ -is [string]) { $_ } else { $_.ModuleName }
36-
})
35+
$requiredModules = @($manifest.RequiredModules)
36+
$requiredModuleNames = @($requiredModules | ForEach-Object { $_.ModuleName })
3737
$requiredModuleNames | Should -Contain 'posh-git'
3838
$requiredModuleNames | Should -Contain 'git-aliases'
39+
40+
$poshGit = $requiredModules | Where-Object { $_.ModuleName -eq 'posh-git' } | Select-Object -First 1
41+
$gitAliases = $requiredModules | Where-Object { $_.ModuleName -eq 'git-aliases' } | Select-Object -First 1
42+
$poshGit.ModuleVersion | Should -Be '1.1.0'
43+
$gitAliases.ModuleVersion | Should -Be '0.3.8'
3944
}
4045
}
4146

@@ -64,6 +69,7 @@ Describe 'git-aliases-extra tooling' {
6469
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'CHANGELOG.md')) | Should -BeTrue
6570
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'assets\icon.png')) | Should -BeTrue
6671
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'tools\get-release-notes.ps1')) | Should -BeTrue
72+
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'tools\prepare-publish.ps1')) | Should -BeTrue
6773
}
6874

6975
It 'resolves release notes from changelog for manifest version' {
@@ -73,4 +79,30 @@ Describe 'git-aliases-extra tooling' {
7379
$notes = & $scriptPath -Version $version
7480
$notes | Should -Not -BeNullOrEmpty
7581
}
82+
83+
It 'prepares runtime-only publish layout' {
84+
$scriptPath = Join-Path $script:RepoRoot 'tools\prepare-publish.ps1'
85+
$stagingPath = Join-Path ([IO.Path]::GetTempPath()) ("gae-stage-{0}" -f [guid]::NewGuid().ToString('N'))
86+
87+
try {
88+
$output = & $scriptPath -SourcePath $script:RepoRoot -OutputPath $stagingPath
89+
$output | Should -Be $stagingPath
90+
91+
(Test-Path -LiteralPath (Join-Path $stagingPath 'git-aliases-extra.psd1')) | Should -BeTrue
92+
(Test-Path -LiteralPath (Join-Path $stagingPath 'git-aliases-extra.psm1')) | Should -BeTrue
93+
(Test-Path -LiteralPath (Join-Path $stagingPath 'README.md')) | Should -BeTrue
94+
(Test-Path -LiteralPath (Join-Path $stagingPath 'LICENSE')) | Should -BeTrue
95+
(Test-Path -LiteralPath (Join-Path $stagingPath 'CHANGELOG.md')) | Should -BeTrue
96+
(Test-Path -LiteralPath (Join-Path $stagingPath 'assets\icon.png')) | Should -BeTrue
97+
98+
(Test-Path -LiteralPath (Join-Path $stagingPath 'tests')) | Should -BeFalse
99+
(Test-Path -LiteralPath (Join-Path $stagingPath 'tools')) | Should -BeFalse
100+
(Test-Path -LiteralPath (Join-Path $stagingPath '.github')) | Should -BeFalse
101+
102+
{ Test-ModuleManifest -Path (Join-Path $stagingPath 'git-aliases-extra.psd1') -ErrorAction Stop } |
103+
Should -Not -Throw
104+
} finally {
105+
Remove-Item -LiteralPath $stagingPath -Recurse -Force -ErrorAction SilentlyContinue
106+
}
107+
}
76108
}

tools/prepare-publish.ps1

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
[CmdletBinding()]
2+
param(
3+
[string]$SourcePath = '',
4+
[string]$OutputPath = ''
5+
)
6+
7+
$ErrorActionPreference = 'Stop'
8+
Set-StrictMode -Version Latest
9+
10+
if (-not $SourcePath) {
11+
$SourcePath = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..') |
12+
Select-Object -ExpandProperty Path -First 1
13+
} else {
14+
$SourcePath = Resolve-Path -LiteralPath $SourcePath |
15+
Select-Object -ExpandProperty Path -First 1
16+
}
17+
18+
if (-not $OutputPath) {
19+
$OutputPath = Join-Path ([IO.Path]::GetTempPath()) ("git-aliases-extra-publish-{0}" -f [guid]::NewGuid().ToString('N'))
20+
}
21+
22+
$manifestPath = Join-Path $SourcePath 'git-aliases-extra.psd1'
23+
if (-not (Test-Path -LiteralPath $manifestPath)) {
24+
throw "Manifest not found: $manifestPath"
25+
}
26+
27+
$manifest = Test-ModuleManifest -Path $manifestPath -ErrorAction Stop
28+
29+
if (Test-Path -LiteralPath $OutputPath) {
30+
Remove-Item -LiteralPath $OutputPath -Recurse -Force
31+
}
32+
33+
New-Item -ItemType Directory -Path $OutputPath -Force | Out-Null
34+
35+
$filesToCopy = @(
36+
'git-aliases-extra.psd1',
37+
$manifest.RootModule,
38+
'README.md',
39+
'LICENSE',
40+
'CHANGELOG.md'
41+
) | Select-Object -Unique
42+
43+
foreach ($relativePath in $filesToCopy) {
44+
$source = Join-Path $SourcePath $relativePath
45+
if (-not (Test-Path -LiteralPath $source)) {
46+
throw "Required publish file missing: $relativePath"
47+
}
48+
49+
$destination = Join-Path $OutputPath $relativePath
50+
$destinationDir = Split-Path -Parent $destination
51+
if ($destinationDir -and -not (Test-Path -LiteralPath $destinationDir)) {
52+
New-Item -ItemType Directory -Path $destinationDir -Force | Out-Null
53+
}
54+
55+
Copy-Item -LiteralPath $source -Destination $destination -Force
56+
}
57+
58+
$optionalDirs = @('assets')
59+
foreach ($dirName in $optionalDirs) {
60+
$sourceDir = Join-Path $SourcePath $dirName
61+
if (-not (Test-Path -LiteralPath $sourceDir)) {
62+
continue
63+
}
64+
65+
Copy-Item -LiteralPath $sourceDir -Destination (Join-Path $OutputPath $dirName) -Recurse -Force
66+
}
67+
68+
Test-ModuleManifest -Path (Join-Path $OutputPath 'git-aliases-extra.psd1') -ErrorAction Stop | Out-Null
69+
70+
$OutputPath

0 commit comments

Comments
 (0)