From a8001604f745e3646a953a9bc5b829576e178dd8 Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Tue, 23 Jul 2024 09:50:48 -0700 Subject: [PATCH 1/5] Remove the extra "default" build --- .goreleaser.yml | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index a3972075..b7051992 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -7,7 +7,7 @@ before: - go mod download builds: - - &COMMON + - &BUILD env: - CGO_ENABLED=0 main: ./cmd/step/main.go @@ -15,9 +15,6 @@ builds: - -trimpath ldflags: - -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}} - - - << : *COMMON - id: default targets: - darwin_amd64 - darwin_arm64 @@ -35,12 +32,12 @@ builds: - windows_arm64 binary: bin/step - - << : *COMMON + << : *BUILD id: debug gcflags: all=-N -l - # This build is for S3 binaries that follow our naming convention there. - << : *COMMON + << : *BUILD id: s3-versioned targets: - darwin_amd64 @@ -52,7 +49,7 @@ builds: binary: 'step_{{ .Version }}_{{ .Os }}_{{ .Arch }}' - # This build is for S3 unversioned binaries that follow our naming convention there. - << : *COMMON + << : *BUILD id: s3-unversioned targets: - darwin_amd64 @@ -67,7 +64,7 @@ builds: # It's exactly the same as the default build above, except: # - it only builds the archs we want to produce .deb and .rpm files for # - the name of the output binary is step-cli - << : *COMMON + << : *BUILD id: nfpm goos: - linux From 1e4dc362458d43ebb5c7962f8ecfc2bae0f2fbf2 Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Tue, 23 Jul 2024 10:20:23 -0700 Subject: [PATCH 2/5] Explicitly name the default build 'step' --- .goreleaser.yml | 11 ++++++----- Makefile | 7 ++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index b7051992..3f8f4054 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -8,6 +8,7 @@ before: builds: - &BUILD + id: default env: - CGO_ENABLED=0 main: ./cmd/step/main.go @@ -15,6 +16,9 @@ builds: - -trimpath ldflags: - -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}} + gcflags: + - >- + {{- if ne .Env.DEBUG "" }}all=-N -l{{- end }} targets: - darwin_amd64 - darwin_arm64 @@ -31,10 +35,6 @@ builds: - windows_amd64 - windows_arm64 binary: bin/step - - - << : *BUILD - id: debug - gcflags: all=-N -l - # This build is for S3 binaries that follow our naming convention there. << : *BUILD @@ -75,6 +75,7 @@ builds: archives: - &ARCHIVE + id: default # Can be used to change the archive formats for specific GOOSs. # Most common use case is to archive as zip on Windows. # Default is empty. @@ -83,7 +84,7 @@ archives: - goos: windows format: zip builds: - - default + - step wrap_in_directory: "{{ .ProjectName }}_{{ .Version }}" files: - README.md diff --git a/Makefile b/Makefile index f9c2cec0..ab94ec48 100644 --- a/Makefile +++ b/Makefile @@ -23,9 +23,6 @@ CGO_OVERRIDE?=CGO_ENABLED=0 # which build id in .goreleaser.yml to build GORELEASER_BUILD_ID?=default -ifdef DEBUG - GORELEASER_BUILD_ID=debug -endif all: lint test build @@ -120,8 +117,8 @@ $(PREFIX)/$(BINNAME): goreleaser: $Q mkdir -p $(PREFIX) - $Q $(GOOS_OVERRIDE) $(CGO_OVERRIDE) goreleaser build \ - --id $(GORELEASER_BUILD_ID) \ + $Q $(GOOS_OVERRIDE) $(CGO_OVERRIDE) DEBUG=$(DEBUG) goreleaser build \ + --id $(GORELEASER_BUILD_ID) --snapshot \ --single-target \ --clean \ From cf4934ab6b17651902f84ea1121b02acb5f3e352 Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Tue, 23 Jul 2024 11:32:08 -0700 Subject: [PATCH 3/5] Default id back in makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index ab94ec48..96a20069 100644 --- a/Makefile +++ b/Makefile @@ -118,7 +118,7 @@ $(PREFIX)/$(BINNAME): goreleaser: $Q mkdir -p $(PREFIX) $Q $(GOOS_OVERRIDE) $(CGO_OVERRIDE) DEBUG=$(DEBUG) goreleaser build \ - --id $(GORELEASER_BUILD_ID) + --id $(GORELEASER_BUILD_ID) \ --snapshot \ --single-target \ --clean \ From 47e081a571955f395354ae726b6e14a67aa8dba2 Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Tue, 23 Jul 2024 11:47:56 -0700 Subject: [PATCH 4/5] Fix debug --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index 3f8f4054..a8090f06 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -18,7 +18,7 @@ builds: - -w -X main.Version={{.Version}} -X main.BuildTime={{.Date}} gcflags: - >- - {{- if ne .Env.DEBUG "" }}all=-N -l{{- end }} + {{- if ne (index .Env "DEBUG") "" }}all=-N -l{{- end }} targets: - darwin_amd64 - darwin_arm64 From 6ee06307e06b85c106ba5bc0b1e4bcd6623e44e2 Mon Sep 17 00:00:00 2001 From: Carl Tashian Date: Tue, 23 Jul 2024 12:10:47 -0700 Subject: [PATCH 5/5] Fix builds --- .goreleaser.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yml b/.goreleaser.yml index a8090f06..97e435f6 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -84,7 +84,7 @@ archives: - goos: windows format: zip builds: - - step + - default wrap_in_directory: "{{ .ProjectName }}_{{ .Version }}" files: - README.md