From 0fe6c45b212f0bc3de2fc2139ecf6c6441924cde Mon Sep 17 00:00:00 2001 From: Marcel Bertagnini Date: Thu, 26 Mar 2026 10:33:26 +0100 Subject: [PATCH 1/2] ci(release): add goreleaser config and GitHub Actions workflow Enable automated cross-platform binary releases triggered by version tags, so consumers can download pre-built binaries instead of building from source. Closes #21 Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Marcel Bertagnini --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++ .goreleaser.yaml | 59 +++++++++++++++++++++++++++++++++++ 2 files changed, 108 insertions(+) create mode 100644 .github/workflows/release.yml create mode 100644 .goreleaser.yaml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..3df5739 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,49 @@ +# Copyright (C) 2026 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: release + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + release: + name: Release + runs-on: ubuntu-24.04 + + steps: + - name: Checkout code + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0 + with: + go-version-file: 'go.mod' + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 + with: + version: latest + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..4b2cc3c --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,59 @@ +# Copyright (C) 2026 Red Hat, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +version: 2 + +builds: + - main: ./cmd/kortex-cli + binary: kortex-cli + ldflags: + - -s -w + - -X github.com/kortex-hub/kortex-cli/pkg/version.Version={{.Version}} + env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + +archives: + - formats: tar.gz + name_template: >- + {{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }} + format_overrides: + - goos: windows + formats: zip + +checksum: + name_template: checksums.txt + algorithm: sha256 + +changelog: + sort: asc + filters: + exclude: + - "^docs:" + - "^test:" + - "^ci:" + - "^chore:" + +release: + github: + owner: kortex-hub + name: kortex-cli From cc5ee70a7d19b13f003a31f167fe11077d22eb5c Mon Sep 17 00:00:00 2001 From: Marcel Bertagnini Date: Thu, 26 Mar 2026 11:10:11 +0100 Subject: [PATCH 2/2] ci(release): pin goreleaser version, add mod tidy hook, remove checksums Address PR review feedback: pin goreleaser to ~> v2.14 for reproducible builds, add go mod tidy before hook, and drop checksums.txt since GitHub natively provides SHA-256 digests for release assets. Co-Authored-By: Claude Opus 4.6 (1M context) Signed-off-by: Marcel Bertagnini --- .github/workflows/release.yml | 2 +- .goreleaser.yaml | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3df5739..c9ad8ac 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,7 +43,7 @@ jobs: - name: Run GoReleaser uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7.0.0 with: - version: latest + version: "~> v2.14" args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 4b2cc3c..24c3ec3 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -16,6 +16,10 @@ version: 2 +before: + hooks: + - go mod tidy + builds: - main: ./cmd/kortex-cli binary: kortex-cli @@ -40,10 +44,6 @@ archives: - goos: windows formats: zip -checksum: - name_template: checksums.txt - algorithm: sha256 - changelog: sort: asc filters: