Skip to content

Commit eedc9f3

Browse files
committed
Prepare publishing to PSGallery
1 parent b0a9c59 commit eedc9f3

File tree

7 files changed

+132
-11
lines changed

7 files changed

+132
-11
lines changed

.github/workflows/publish.yml

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,24 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414

15+
- name: Install Dependencies
16+
shell: pwsh
17+
run: |
18+
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
19+
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Scope CurrentUser -Force
20+
}
21+
Set-PSRepository PSGallery -InstallationPolicy Trusted
22+
Install-Module PSScriptAnalyzer -Scope CurrentUser -RequiredVersion 1.22.0 -Force
23+
Install-Module Pester -Scope CurrentUser -RequiredVersion 5.7.1 -Force
24+
Install-Module posh-git -Scope CurrentUser -Force
25+
Install-Module git-aliases -Scope CurrentUser -Force
26+
Install-Module PowerShellGet -Scope CurrentUser -RequiredVersion 2.2.5 -Force
27+
28+
- name: Run Lint and Tests
29+
shell: pwsh
30+
run: |
31+
.\tools\ci.ps1
32+
1533
- name: Validate Module Version Against Tag
1634
if: startsWith(github.ref, 'refs/tags/v')
1735
shell: pwsh
@@ -22,14 +40,21 @@ jobs:
2240
throw "Manifest version '$($manifest.Version)' does not match tag version '$tagVersion'."
2341
}
2442
25-
- name: Install PowerShellGet
43+
- name: Validate and Stage Release Notes
2644
shell: pwsh
2745
run: |
28-
if (-not (Get-PackageProvider -Name NuGet -ErrorAction SilentlyContinue)) {
29-
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Scope CurrentUser -Force
46+
$manifestPath = Resolve-Path -LiteralPath .\git-aliases-extra.psd1 |
47+
Select-Object -ExpandProperty Path -First 1
48+
$manifest = Test-ModuleManifest -Path $manifestPath -ErrorAction Stop
49+
$moduleVersion = $manifest.Version.ToString()
50+
51+
$releaseNotes = .\tools\get-release-notes.ps1 -Version $moduleVersion
52+
if (-not $releaseNotes) {
53+
throw "Release notes for version '$moduleVersion' are empty."
3054
}
31-
Set-PSRepository PSGallery -InstallationPolicy Trusted
32-
Install-Module PowerShellGet -Scope CurrentUser -Force
55+
56+
Update-ModuleManifest -Path $manifestPath -ReleaseNotes $releaseNotes
57+
Write-Host "Release notes for version '$moduleVersion' loaded from CHANGELOG.md."
3358
3459
- name: Publish to PSGallery
3560
shell: pwsh

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Changelog
2+
3+
All notable changes to this project are documented in this file.
4+
5+
The format is based on Keep a Changelog and the project uses Semantic Versioning.
6+
7+
## [0.1.0] - 2026-02-19
8+
9+
### Added
10+
11+
- Standalone `git-aliases-extra` module extracted from dotfiles.
12+
- Extended git alias completion for custom aliases and long options.
13+
- `gsw` fallback logic for remote-only branch switching edge cases.
14+
- `gfp` helper for `git format-patch --cover-letter --stat --stdout`.
15+
- Worktree aliases with completion support for worktree paths.
16+
- Lint, test, CI workflows, and local hook installation scripts.
17+
18+
### Changed
19+
20+
- Renamed module from `GitAliases.Extras` to `git-aliases-extra`.

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,9 @@ This repository includes:
287287
To publish from CI:
288288

289289
1. Add repository secret `PSGALLERY_API_KEY`.
290-
2. Bump `ModuleVersion` in `git-aliases-extra.psd1`.
291-
3. Push a tag `v<ModuleVersion>` (for example, `v0.1.0`) or run the publish workflow manually.
290+
2. Add release notes to `CHANGELOG.md` under `## [<ModuleVersion>] - YYYY-MM-DD`.
291+
3. Bump `ModuleVersion` in `git-aliases-extra.psd1`.
292+
4. Push a tag `v<ModuleVersion>` (for example, `v0.1.0`) or run the publish workflow manually.
292293

293294
## What CI checks
294295

@@ -300,4 +301,4 @@ To publish from CI:
300301

301302
## License
302303

303-
WTFPL. See `LICENSE`.
304+
WTFPL. See `LICENSE`.

assets/icon.png

2.18 KB
Loading

git-aliases-extra.psd1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@
44
GUID = 'a5c2859e-7dce-4853-9db5-8cb7927dbdda'
55
Author = 'PhysShell'
66
CompanyName = ''
7-
Copyright = 'Copyright (c) PhysShell.'
7+
Copyright = 'Copyright (c) PhysShell 2026.'
88
Description = 'Custom git aliases and robust tab completion helpers for PowerShell.'
99
PowerShellVersion = '5.1'
10+
HelpInfoURI = 'https://github.com/PhysShell/git-aliases-extra'
1011
CompatiblePSEditions = @('Desktop', 'Core')
1112
FunctionsToExport = @(
1213
'Test-InGitRepo',
@@ -52,11 +53,14 @@
5253
RequiredModules = @('posh-git', 'git-aliases')
5354
PrivateData = @{
5455
PSData = @{
55-
Tags = @('git', 'aliases', 'completion', 'posh-git', 'powershell')
56+
Tags = @('git', 'aliases', 'completion', 'posh-git', 'powershell', 'worktree')
5657
ProjectUri = 'https://github.com/PhysShell/git-aliases-extra'
5758
LicenseUri = 'https://github.com/PhysShell/git-aliases-extra/blob/main/LICENSE'
59+
IconUri = 'https://raw.githubusercontent.com/PhysShell/git-aliases-extra/main/assets/icon.png'
5860
RepositorySourceLocation = 'https://github.com/PhysShell/git-aliases-extra'
59-
ReleaseNotes = 'Standalone module extracted from dotfiles.'
61+
ReleaseNotes = 'See CHANGELOG.md for release notes.'
62+
ExternalModuleDependencies = @('posh-git', 'git-aliases')
63+
RequireLicenseAcceptance = $false
6064
}
6165
}
6266
}

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ Describe 'git-aliases-extra manifest' {
2727
$manifest = Import-PowerShellDataFile -Path $script:ModuleManifest
2828
$manifest.PrivateData.PSData.ProjectUri | Should -Match '^https://github.com/PhysShell/git-aliases-extra'
2929
$manifest.PrivateData.PSData.LicenseUri | Should -Match '/LICENSE$'
30+
$manifest.PrivateData.PSData.IconUri | Should -Match '/assets/icon\.png$'
31+
$manifest.PrivateData.PSData.ReleaseNotes | Should -Not -BeNullOrEmpty
32+
$manifest.Copyright | Should -Match '\b\d{4}\b'
3033

3134
$requiredModuleNames = @($manifest.RequiredModules | ForEach-Object {
3235
if ($_ -is [string]) { $_ } else { $_.ModuleName }
@@ -56,4 +59,18 @@ Describe 'git-aliases-extra tooling' {
5659
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'tools\hooks\pre-commit')) | Should -BeTrue
5760
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'tools\hooks\commit-msg')) | Should -BeTrue
5861
}
62+
63+
It 'includes changelog, icon and release notes helper script' {
64+
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'CHANGELOG.md')) | Should -BeTrue
65+
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'assets\icon.png')) | Should -BeTrue
66+
(Test-Path -LiteralPath (Join-Path $script:RepoRoot 'tools\get-release-notes.ps1')) | Should -BeTrue
67+
}
68+
69+
It 'resolves release notes from changelog for manifest version' {
70+
$manifest = Test-ModuleManifest -Path $script:ModuleManifest -ErrorAction Stop
71+
$version = $manifest.Version.ToString()
72+
$scriptPath = Join-Path $script:RepoRoot 'tools\get-release-notes.ps1'
73+
$notes = & $scriptPath -Version $version
74+
$notes | Should -Not -BeNullOrEmpty
75+
}
5976
}

tools/get-release-notes.ps1

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
[CmdletBinding()]
2+
param(
3+
[Parameter(Mandatory = $true)]
4+
[string]$Version,
5+
6+
[string]$ChangelogPath = ''
7+
)
8+
9+
$ErrorActionPreference = 'Stop'
10+
Set-StrictMode -Version Latest
11+
12+
if (-not $ChangelogPath) {
13+
$ChangelogPath = Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '..\CHANGELOG.md') |
14+
Select-Object -ExpandProperty Path -First 1
15+
}
16+
17+
if (-not (Test-Path -LiteralPath $ChangelogPath)) {
18+
throw "Changelog not found: $ChangelogPath"
19+
}
20+
21+
[string[]]$lines = Get-Content -LiteralPath $ChangelogPath
22+
[string]$escapedVersion = [Regex]::Escape($Version)
23+
[string]$versionHeaderPattern = "^##\s+\[$escapedVersion\]\s+-\s+\d{4}-\d{2}-\d{2}\s*$"
24+
25+
[int]$startIndex = -1
26+
for ($i = 0; $i -lt $lines.Count; $i++) {
27+
if ($lines[$i] -match $versionHeaderPattern) {
28+
$startIndex = $i
29+
break
30+
}
31+
}
32+
33+
if ($startIndex -lt 0) {
34+
throw "No changelog section found for version '$Version' in '$ChangelogPath'."
35+
}
36+
37+
[int]$endIndex = $lines.Count
38+
for ($i = $startIndex + 1; $i -lt $lines.Count; $i++) {
39+
if ($lines[$i] -match '^##\s+\[') {
40+
$endIndex = $i
41+
break
42+
}
43+
}
44+
45+
if ($endIndex -le ($startIndex + 1)) {
46+
throw "Changelog section for version '$Version' is empty."
47+
}
48+
49+
[string]$notes = ($lines[($startIndex + 1)..($endIndex - 1)] -join [Environment]::NewLine).Trim()
50+
if (-not $notes) {
51+
throw "Changelog section for version '$Version' is empty."
52+
}
53+
54+
$notes

0 commit comments

Comments
 (0)