From 72f284f987df1839bad17a399084a7ef5a4cdef6 Mon Sep 17 00:00:00 2001 From: Lukasz Raczylo Date: Sat, 3 Jan 2026 22:12:31 +0000 Subject: [PATCH] fix: correct GoReleaser Pro configuration for CGO and Docker builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: - Used incorrect field names (use: buildx, build_flag_templates) not supported in GoReleaser v2.13.2 - GitHub Actions workflow using non-CGO release workflow - Docker builds failing due to invalid configuration Solution: - Updated dockers_v2 configuration with correct field names: - Removed unsupported `use: buildx` field - Changed `build_flag_templates` to `build_args` (map format) - Kept `platforms` for multi-arch support (linux/amd64, linux/arm64) - Updated GitHub Actions workflow to use go-release-cgo.yaml for CGO support - Build args now passed correctly to Docker builds for version info Changes: - .goreleaser.yaml: Fixed all Docker image configurations - .github/workflows/release.yaml: Changed to go-release-cgo.yaml workflow Validation: - goreleaser check: PASSED ✓ - Configuration validated with GoReleaser Pro v2.13.2 References: - GoReleaser dockers_v2 docs: https://goreleaser.com/customization/dockers_v2/ --- .github/workflows/release.yaml | 3 +- .goreleaser.yaml | 51 ++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 26 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b611811..5cfdb3a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -20,10 +20,9 @@ permissions: jobs: release: - uses: lukaszraczylo/shared-actions/.github/workflows/go-release.yaml@main + uses: lukaszraczylo/shared-actions/.github/workflows/go-release-cgo.yaml@main with: go-version: "1.25" - docker-enabled: true secrets: inherit benchmark: diff --git a/.goreleaser.yaml b/.goreleaser.yaml index c542f7b..c11044e 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -79,14 +79,15 @@ release: dockers_v2: # 1. Application Engine - Main GoHoarder server - id: gohoarder-server - use: buildx images: - ghcr.io/lukaszraczylo/gohoarder-server - build_flag_templates: - - "--platform=linux/amd64,linux/arm64" - - "--build-arg=VERSION={{ .Version }}" - - "--build-arg=GIT_COMMIT={{ .ShortCommit }}" - - "--build-arg=BUILD_TIME={{ .Date }}" + platforms: + - linux/amd64 + - linux/arm64 + build_args: + VERSION: "{{ .Version }}" + GIT_COMMIT: "{{ .ShortCommit }}" + BUILD_TIME: "{{ .Date }}" tags: - "{{ .Version }}" - latest @@ -104,11 +105,11 @@ dockers_v2: # 2. Website - Frontend Dashboard - id: gohoarder-frontend - use: buildx images: - ghcr.io/lukaszraczylo/gohoarder-frontend - build_flag_templates: - - "--platform=linux/amd64,linux/arm64" + platforms: + - linux/amd64 + - linux/arm64 tags: - "{{ .Version }}" - latest @@ -126,14 +127,15 @@ dockers_v2: # 3. Scanning Engine - Background scanner worker - id: gohoarder-scanner - use: buildx images: - ghcr.io/lukaszraczylo/gohoarder-scanner - build_flag_templates: - - "--platform=linux/amd64,linux/arm64" - - "--build-arg=VERSION={{ .Version }}" - - "--build-arg=GIT_COMMIT={{ .ShortCommit }}" - - "--build-arg=BUILD_TIME={{ .Date }}" + platforms: + - linux/amd64 + - linux/arm64 + build_args: + VERSION: "{{ .Version }}" + GIT_COMMIT: "{{ .ShortCommit }}" + BUILD_TIME: "{{ .Date }}" tags: - "{{ .Version }}" - latest @@ -151,11 +153,11 @@ dockers_v2: # 4. Gateway - Nginx reverse proxy for unified deployment - id: gohoarder-gateway - use: buildx images: - ghcr.io/lukaszraczylo/gohoarder-gateway - build_flag_templates: - - "--platform=linux/amd64,linux/arm64" + platforms: + - linux/amd64 + - linux/arm64 tags: - "{{ .Version }}" - latest @@ -171,14 +173,15 @@ dockers_v2: # 5. Migration Engine - Database migration tool - id: gohoarder-migrate - use: buildx images: - ghcr.io/lukaszraczylo/gohoarder-migrate - build_flag_templates: - - "--platform=linux/amd64,linux/arm64" - - "--build-arg=VERSION={{ .Version }}" - - "--build-arg=GIT_COMMIT={{ .ShortCommit }}" - - "--build-arg=BUILD_TIME={{ .Date }}" + platforms: + - linux/amd64 + - linux/arm64 + build_args: + VERSION: "{{ .Version }}" + GIT_COMMIT: "{{ .ShortCommit }}" + BUILD_TIME: "{{ .Date }}" tags: - "{{ .Version }}" - latest