build: use goreleaser build with manual archive creation

goreleaser v2 has a bug with no_unique_dist_dir where it registers
archive tasks for all sub-arch variants even when constraints limit
builds to one per arch, causing archive collision errors. Switch dist
target to use goreleaser build (binaries only) and create tar.gz/zip
archives manually, copying LICENSE and README.md into each platform
directory to match the existing archive structure.

Add sub-arch constraints (goamd64, goarm64, go386, goriscv64) to ensure
only one variant is built per architecture.

Signed-off-by: Terry Howe <terrylhowe@gmail.com>
pull/31343/head
Terry Howe 1 week ago
parent d199a1a42c
commit 64aa46f2f1
No known key found for this signature in database

@ -19,8 +19,16 @@ builds:
- s390x
- riscv64
- loong64
goamd64:
- v1
goarm:
- "7"
goarm64:
- v8.0
go386:
- sse2
goriscv64:
- rva20u64
ignore:
- goos: darwin
goarch: "386"
@ -55,28 +63,6 @@ builds:
- -trimpath
dir: .
archives:
- id: default
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{- .ProjectName }}-
{{- .Version }}-
{{- .Os }}-
{{- .Arch }}
formats:
- tar.gz
format_overrides:
- goos: windows
formats:
- tar.gz
- zip
files:
- LICENSE
- README.md
checksum:
disable: true
snapshot:
version_template: "{{ if index .Env \"GORELEASER_CURRENT_TAG\" }}{{ .Env.GORELEASER_CURRENT_TAG }}{{ else }}{{ incpatch .Version }}-next{{ end }}"
@ -85,4 +71,4 @@ changelog:
filters:
exclude:
- '^docs:'
- '^test:'
- '^test:'

@ -177,7 +177,18 @@ build-cross: $(GORELEASER)
.PHONY: dist
dist: $(GORELEASER)
GORELEASER_CURRENT_TAG='$(VERSION)' LDFLAGS='$(LDFLAGS)' $(GORELEASER) release --snapshot --clean
GORELEASER_CURRENT_TAG='$(VERSION)' LDFLAGS='$(LDFLAGS)' $(GORELEASER) build --snapshot --clean
@for platform_dir in _dist/*/; do \
platform=$$(basename "$$platform_dir"); \
{ [ -f "_dist/$$platform/helm" ] || [ -f "_dist/$$platform/helm.exe" ]; } || continue; \
cp LICENSE README.md "_dist/$$platform/"; \
tar czf "_dist/helm-$(VERSION)-$$platform.tar.gz" -C _dist "$$platform/"; \
done
@for platform_dir in _dist/windows-*/; do \
[ -d "$$platform_dir" ] || continue; \
platform=$$(basename "$$platform_dir"); \
(cd _dist && zip -r "helm-$(VERSION)-$$platform.zip" "$$platform/"); \
done
.PHONY: fetch-dist
fetch-dist:

Loading…
Cancel
Save