From 11bf541f7e2bc719b095995af6df0fecf0426458 Mon Sep 17 00:00:00 2001 From: jakobmoellerdev Date: Wed, 23 Oct 2024 12:12:17 +0200 Subject: [PATCH 1/2] chore(ci): remove i386, optimize latest build and add various comments --- .github/config/goreleaser.yaml | 5 +++++ .github/config/latest.yml | 11 +++++------ .../workflows/{push_ocm.yaml => publish-latest.yaml} | 1 + ...publish.yaml => publish-to-other-than-github.yaml} | 10 ++++++++-- .github/workflows/release.yaml | 4 +++- hack/chocolatey/tools/chocolateyinstall.ps1 | 4 ---- hack/chocolatey/update.ps1 | 10 ++-------- 7 files changed, 24 insertions(+), 21 deletions(-) rename .github/workflows/{push_ocm.yaml => publish-latest.yaml} (99%) rename .github/workflows/{publish.yaml => publish-to-other-than-github.yaml} (92%) diff --git a/.github/config/goreleaser.yaml b/.github/config/goreleaser.yaml index 3df296436..60696bf9f 100644 --- a/.github/config/goreleaser.yaml +++ b/.github/config/goreleaser.yaml @@ -1,3 +1,5 @@ +# goreleaser.yaml (this config) is responsible for our official releases. +# However, latest builds (equivalent to nightlies based on the main branch), uses latest.yml version: 2 before: @@ -33,6 +35,9 @@ builds: id: windows goos: - windows + goarch: + - amd64 + - arm64 archives: - name_template: "{{ .Binary }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}" diff --git a/.github/config/latest.yml b/.github/config/latest.yml index 7f199af2b..fc7b163cb 100644 --- a/.github/config/latest.yml +++ b/.github/config/latest.yml @@ -1,11 +1,7 @@ -# .goreleaser.yml - +# this file only takes care of the latest builds (equivalent to nightlies based on the main branch), +# for the official (real) release, check goreleaser.yaml version: 2 -before: - hooks: - - go mod tidy - builds: - <<: &build_defaults binary: ocm @@ -34,6 +30,9 @@ builds: id: windows goos: - windows + goarch: + - amd64 + - arm64 archives: - name_template: "{{ .Binary }}-latest-{{ .Os }}-{{ .Arch }}" diff --git a/.github/workflows/push_ocm.yaml b/.github/workflows/publish-latest.yaml similarity index 99% rename from .github/workflows/push_ocm.yaml rename to .github/workflows/publish-latest.yaml index 3288ef187..7d2ee728b 100644 --- a/.github/workflows/push_ocm.yaml +++ b/.github/workflows/publish-latest.yaml @@ -10,6 +10,7 @@ on: - '**/*.mod' - '**/*.sum' - 'resources/**' + - '.github/config/latest.yml' jobs: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish-to-other-than-github.yaml similarity index 92% rename from .github/workflows/publish.yaml rename to .github/workflows/publish-to-other-than-github.yaml index cae3c2a67..443ec4d48 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish-to-other-than-github.yaml @@ -1,4 +1,11 @@ -name: Publish Release +# This publish step takes care of some (but not all ;) ) of the package registries +# that we think might be useful for people to consume. +# +# Other package registries might also be pushed in the goreleaser step (see publish-latest.yaml) and are configured +# within .github/config/goreleaser.yaml. +# +# TODO: Unify +name: Publish Release to other package registries than Github on: workflow_dispatch: @@ -118,7 +125,6 @@ jobs: run: | cd hack\winget wingetcreate update --submit --token ${{ steps.generate_token.outputs.token }} --urls ` - https://github.com/open-component-model/ocm/releases/download/v${{ env.RELEASE_VERSION }}/ocm-${{ env.RELEASE_VERSION }}-windows-386.zip ` https://github.com/open-component-model/ocm/releases/download/v${{ env.RELEASE_VERSION }}/ocm-${{ env.RELEASE_VERSION }}-windows-amd64.zip ` https://github.com/open-component-model/ocm/releases/download/v${{ env.RELEASE_VERSION }}/ocm-${{ env.RELEASE_VERSION }}-windows-arm64.zip ` --version ${{ env.RELEASE_VERSION }} ` diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 129dd56f3..d6502d34e 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -296,6 +296,8 @@ jobs: event-type: ocm-cli-release client-payload: '{"tag": "${{ env.RELEASE_VERSION }}"}' + # now distribute the release event so that other jobs can listen for this + # and use the event to publish our release to other package registries - name: Publish Release Event for other package registries if: inputs.release_candidate == false uses: peter-evans/repository-dispatch@v3 @@ -303,4 +305,4 @@ jobs: token: ${{ steps.generate_token.outputs.token }} repository: open-component-model/ocm event-type: ocm-cli-release - client-payload: '{"version": "${{ env.RELEASE_VERSION }}"}' + client-payload: '{"version": "${{ env.RELEASE_VERSION }}"}' \ No newline at end of file diff --git a/hack/chocolatey/tools/chocolateyinstall.ps1 b/hack/chocolatey/tools/chocolateyinstall.ps1 index bdf0ea83e..0392e0330 100644 --- a/hack/chocolatey/tools/chocolateyinstall.ps1 +++ b/hack/chocolatey/tools/chocolateyinstall.ps1 @@ -1,17 +1,13 @@ $ErrorActionPreference = 'Stop' $toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)" -$url = "run: update.ps1" $url64 = "run: update.ps1" $packageArgs = @{ packageName = $env:ChocolateyPackageName unzipLocation = $toolsDir - url = $url url64bit = $url64 softwareName = 'ocm-cli*' - checksum = 'run: update.ps1' - checksumType = 'sha256' checksum64 = 'run: update.ps1' checksumType64= 'sha256' } diff --git a/hack/chocolatey/update.ps1 b/hack/chocolatey/update.ps1 index 2c76a04f9..329026621 100644 --- a/hack/chocolatey/update.ps1 +++ b/hack/chocolatey/update.ps1 @@ -18,11 +18,8 @@ $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 -$sha256 = [System.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri $sha256url).Content) $sha256_64 = [System.Text.Encoding]::UTF8.GetString((Invoke-WebRequest -Uri $sha256url64).Content) # Update the description and release notes in the nuspec file @@ -58,13 +55,10 @@ Write-Output "Updated the tag in the nuspec file with the sorted list # Update the install script with the new URLs $scriptPath = Join-Path -Path $PSScriptRoot -ChildPath "tools\chocolateyinstall.ps1" $scriptContent = Get-Content -Path $scriptPath -Raw -$updatedContent = $scriptContent -replace '\$url\s*=\s*".*"', (-join('$url = "', $url, '"')) -$updatedContent = $updatedContent -replace '\$url64\s*=\s*".*"', (-join('$url64 = "', $url64, '"')) -$updatedContent = $updatedContent -replace "checksum\s*=\s*'.*'", "checksum = '$sha256'" +$updatedContent = $scriptContent -replace '\$url64\s*=\s*".*"', (-join('$url64 = "', $url64, '"')) $updatedContent = $updatedContent -replace "checksum64\s*=\s*'.*'", "checksum64 = '$sha256_64'" Set-Content -Path $scriptPath -Value $updatedContent -Write-Output "Using $url ($sha256)" -Write-Output "and $url64 ($sha256_64) as package sources." +Write-Output "Using $url64 ($sha256_64) as package sources." # Copy the LICENSE file to the tools directory $licenseDest = Join-Path -Path $PSScriptRoot -ChildPath "tools\LICENSE.txt" From 4bae566f600887bf935b2d4b688c1d85bfe65f99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20M=C3=B6ller?= Date: Wed, 23 Oct 2024 12:20:54 +0200 Subject: [PATCH 2/2] chore(ci): remove i386, optimize latest build and add various comments Co-authored-by: Hilmar Falkenberg --- .github/workflows/publish-to-other-than-github.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish-to-other-than-github.yaml b/.github/workflows/publish-to-other-than-github.yaml index 443ec4d48..4e3d95139 100644 --- a/.github/workflows/publish-to-other-than-github.yaml +++ b/.github/workflows/publish-to-other-than-github.yaml @@ -1,7 +1,7 @@ # This publish step takes care of some (but not all ;) ) of the package registries # that we think might be useful for people to consume. # -# Other package registries might also be pushed in the goreleaser step (see publish-latest.yaml) and are configured +# Other package registries might also be pushed in the goreleaser step (see release.yaml) and are configured # within .github/config/goreleaser.yaml. # # TODO: Unify