From 18e0e466611a09ca528aa0ba21d7006b3cf80eb4 Mon Sep 17 00:00:00 2001 From: Hilmar Falkenberg Date: Thu, 26 Sep 2024 17:47:58 +0200 Subject: [PATCH] Fix/publish release (#939) #### What this PR does / why we need it We got some feedback on the chocolatey package: https://community.chocolatey.org/packages/ocm-cli/0.14.0 #### Which issue(s) this PR fixes should fix the failures during the last `Publish Release` run - https://github.com/open-component-model/ocm/actions/runs/10851542348 --- .github/workflows/publish.yaml | 2 +- hack/chocolatey/ocm-cli.nuspec | 4 ++-- hack/chocolatey/tools/chocolateyuninstall.ps1 | 22 ------------------- hack/chocolatey/update.ps1 | 10 +++++---- 4 files changed, 9 insertions(+), 29 deletions(-) delete mode 100644 hack/chocolatey/tools/chocolateyuninstall.ps1 diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 12285b90f..f506f4661 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -34,7 +34,7 @@ jobs: with: name: aur key: ${{ secrets.ARCHLINUX_SSH_PRIVATE_KEY }} - known_hosts: ${{ secrets.ARCHLINUX_SSH_KNOWN_HOSTS }} + known_hosts: ${{ secrets.ARCHLINUX_KNOWN_HOSTS }} config: ${{ secrets.ARCHLINUX_SSH_CONFIG}} - name: Setup git config run: | diff --git a/hack/chocolatey/ocm-cli.nuspec b/hack/chocolatey/ocm-cli.nuspec index a10ed8187..9ea1a1c4a 100644 --- a/hack/chocolatey/ocm-cli.nuspec +++ b/hack/chocolatey/ocm-cli.nuspec @@ -13,13 +13,13 @@ This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Refe ocm-cli $version$ - https://github.com/open-component-model/ocm/releases/latest + https://github.com/open-component-model/ocm/tree/main/hack/chocolatey SAP SE Open Component Model Command Line Interface (ocm-cli) - ccwienk, dee0sap, fabianburth, frewilhelm, hilmarf, ikhandamirov, jensh007, jmickey, jschicktanz, mandelsoft, MartinWeindel, maximilianbraun, maximiliantech, morri-son, morrison-sap, nikimanoledaki, phoban01, robertwol, Shegox, shivenduverma-sap, Skarlso, souleb, vasu1124, yitsushi + ccwienk, dee0sap, fabianburth, frewilhelm, hilmarf, ikhandamirov, jakobmoellerdev, jensh007, jmickey, jschicktanz, mandelsoft, MartinWeindel, maximilianbraun, maximiliantech, morri-son, morrison-sap, nikimanoledaki, phoban01, robertwol, Shegox, shivenduverma-sap, Skarlso, souleb, vasu1124, yitsushi https://ocm.software/ diff --git a/hack/chocolatey/tools/chocolateyuninstall.ps1 b/hack/chocolatey/tools/chocolateyuninstall.ps1 deleted file mode 100644 index 91406a2aa..000000000 --- a/hack/chocolatey/tools/chocolateyuninstall.ps1 +++ /dev/null @@ -1,22 +0,0 @@ -$ErrorActionPreference = 'Stop' -$packageArgs = @{ - packageName = $env:ChocolateyPackageName - softwareName = 'ocm-cli*' - fileType = 'exe' -} - -[array]$key = Get-UninstallRegistryKey -SoftwareName $packageArgs['softwareName'] - -if ($key.Count -eq 1) { - $key | % { - $packageArgs['file'] = "$($_.UninstallString)" - Uninstall-ChocolateyPackage @packageArgs - } -} elseif ($key.Count -eq 0) { - Write-Warning "$packageName has already been uninstalled by other means." -} elseif ($key.Count -gt 1) { - Write-Warning "$($key.Count) matches found!" - Write-Warning "To prevent accidental data loss, no programs will be uninstalled." - Write-Warning "Please alert package maintainer the following keys were matched:" - $key | % {Write-Warning "- $($_.DisplayName)"} -} diff --git a/hack/chocolatey/update.ps1 b/hack/chocolatey/update.ps1 index f2c9bdff9..c7f011143 100644 --- a/hack/chocolatey/update.ps1 +++ b/hack/chocolatey/update.ps1 @@ -18,10 +18,10 @@ $response = Invoke-RestMethod -Uri $url -Headers @{ "User-Agent" = "PowerShell" $latestVersion = $response.tag_name -replace '^v', '' Write-Output "The latest released ocm-cli version is $latestVersion" $assets = $response.assets -$url = $assets | Where-Object { $_.name -match 'windows-386.zip' } | Select-Object -ExpandProperty browser_download_url -$url64 = $assets | Where-Object { $_.name -match 'windows-amd64.zip' } | Select-Object -ExpandProperty browser_download_url -$sha256url = $assets | Where-Object { $_.name -match 'windows-386.zip.sha256' } | Select-Object -ExpandProperty browser_download_url -$sha256url64 = $assets | Where-Object { $_.name -match 'windows-amd64.zip.sha256' } | Select-Object -ExpandProperty browser_download_url +$url = $assets | Where-Object { $_.name -match 'windows-386.zip$' } | Select-Object -ExpandProperty browser_download_url +$url64 = $assets | Where-Object { $_.name -match 'windows-amd64.zip$' } | Select-Object -ExpandProperty browser_download_url +$sha256url = $assets | Where-Object { $_.name -match 'windows-386.zip.sha256$' } | Select-Object -ExpandProperty browser_download_url +$sha256url64 = $assets | Where-Object { $_.name -match 'windows-amd64.zip.sha256$' } | Select-Object -ExpandProperty browser_download_url $sha256 = [System.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri $sha256url).Content) $sha256_64 = [System.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri $sha256url64).Content) @@ -48,6 +48,8 @@ $description += "`nContinue reading on [ocm.software / cli-reference](https://oc # release notes do hopefully not contain xml tags $releaseNotes = Get-Content -Path "docs\releasenotes\v$latestVersion.md" -Raw $releaseNotes = $releaseNotes -replace '\(#(\d+)\)', '([$1](https://github.com/open-component-model/ocm/pull/$1))' +$releaseNotes = $releaseNotes -replace '.*', '' +$releaseNotes = $releaseNotes -replace '', '' $updatedContent = $updatedContent -replace '(?ms).*<\/description>', "$description" $updatedContent = $updatedContent -replace '(?ms).*<\/releaseNotes>', "$releaseNotes" Set-Content -Path $nuspecPath -Value $updatedContent