Skip to content

Commit 5cb2d8b

Browse files
Fix: replace content of existing updater.xml
1 parent 4f519da commit 5cb2d8b

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

.github/workflows/deploy-release.yml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
mkdir -p artifacts/setup
9191
copy installer\Output\CleanMyPosts-Setup-${{ env.VERSION }}.exe artifacts\setup\
9292
93-
- name: Generate update.xml
93+
- name: Generate update.xml from template
9494
shell: pwsh
9595
run: |
9696
$version = "${{ env.VERSION }}"
@@ -99,22 +99,17 @@ jobs:
9999
$installerUrl = "$baseUrl/CleanMyPosts-Setup-$version.exe"
100100
$changelogUrl = "https://github.com/$repo/releases/tag/v$version"
101101
102-
$xmlContent = @"
103-
<?xml version='1.0' encoding='utf-8'?>
104-
<updates>
105-
<application>
106-
<name>CleanMyPosts</name>
107-
<version>$version</version>
108-
<url>$installerUrl</url>
109-
<changelog>$changelogUrl</changelog>
110-
</application>
111-
</updates>
112-
"@
102+
$template = Get-Content "update.xml" -Raw
103+
$xmlContent = $template `
104+
-replace "{{VERSION}}", $version `
105+
-replace "{{INSTALLER_URL}}", $installerUrl `
106+
-replace "{{CHANGELOG_URL}}", $changelogUrl
113107
108+
if (-not (Test-Path "artifacts")) {
109+
New-Item -ItemType Directory -Path "artifacts" | Out-Null
110+
}
114111
$xmlContent | Set-Content -Path "artifacts/update.xml" -Encoding UTF8
115112
116-
117-
118113
- name: Configure Git Credentials
119114
run: |
120115
echo "https://${{ secrets.GH_APIKEY }}@github.com" > $env:USERPROFILE\.git-credentials

0 commit comments

Comments
 (0)