Skip to content

Commit d2ddf4c

Browse files
Update publish.yml
1 parent 72b5f94 commit d2ddf4c

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,40 @@ on:
99
jobs:
1010
build:
1111
runs-on: windows-latest
12+
1213
steps:
1314
- uses: actions/checkout@v3
1415

16+
# Install BuildHelpers with AllowClobber
1517
- name: Install BuildHelpers with AllowClobber
1618
shell: pwsh
1719
run: |
1820
Install-Module BuildHelpers -Force -AllowClobber -Scope CurrentUser
1921
Import-Module BuildHelpers -Force
2022
23+
# Patch Update-Metadata to avoid PropertyName error
24+
- name: Patch Update-Metadata
25+
shell: pwsh
26+
run: |
27+
function Update-Metadata {
28+
param (
29+
[string]$Path,
30+
[string]$PropertyName = 'ModuleVersion',
31+
$Value
32+
)
33+
$content = Get-Content $Path -Raw
34+
$pattern = "$PropertyName\s*=\s*'[^']*'"
35+
if ($content -match $pattern) {
36+
$content = $content -replace $pattern, "$PropertyName = '$Value'"
37+
} else {
38+
Write-Warning "Property $PropertyName not found, appending."
39+
$content += "`n$PropertyName = '$Value'"
40+
}
41+
Set-Content -Path $Path -Value $content -Encoding UTF8
42+
Write-Host "Updated '$PropertyName' in $Path"
43+
}
44+
Set-Alias -Name Update-Metadata -Value Update-Metadata -Scope Global
45+
2146
- name: Check if version has been bumped
2247
shell: pwsh
2348
id: check_if_versions_bumped

0 commit comments

Comments
 (0)