From ad30989163da66d0d16be5a86568213ca2cd9e9b Mon Sep 17 00:00:00 2001 From: Bruno Borges Date: Tue, 14 Jul 2026 22:05:25 -0400 Subject: [PATCH] Fix settings.xml publishing validation Update the publishing e2e check to assert the settings.xml generated when gpg-passphrase is MAVEN_GPG_PASSPHRASE. In that default case the action no longer writes a gpg.passphrase server entry. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 7d0a510e-aebf-4ec4-a667-efeb3e4edeb1 --- .github/workflows/e2e-publishing.yml | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e-publishing.yml b/.github/workflows/e2e-publishing.yml index 02a6b259..87316059 100644 --- a/.github/workflows/e2e-publishing.yml +++ b/.github/workflows/e2e-publishing.yml @@ -46,13 +46,25 @@ jobs: $xmlPath = Join-Path $HOME ".m2" "settings.xml" Get-Content $xmlPath | ForEach-Object { Write-Host $_ } - [xml]$xml = Get-Content $xmlPath - $servers = $xml.settings.servers.server - if (($servers[0].id -ne 'maven') -or ($servers[0].username -ne '${env.MAVEN_USERNAME}') -or ($servers[0].password -ne '${env.MAVEN_CENTRAL_TOKEN}')) { - throw "Generated XML file is incorrect" - } + $content = [System.IO.File]::ReadAllText($xmlPath) + $expected = @( + '' + ' false' + ' ' + ' ' + ' maven' + ' ${env.MAVEN_USERNAME}' + ' ${env.MAVEN_CENTRAL_TOKEN}' + ' ' + ' ' + '' + ) -join "`n" - if (($servers[1].id -ne 'gpg.passphrase') -or ($servers[1].passphrase -ne '${env.MAVEN_GPG_PASSPHRASE}')) { + if ($content -ne $expected) { + Write-Host "Expected settings.xml:" + $expected -split "`n" | ForEach-Object { Write-Host $_ } throw "Generated XML file is incorrect" }