From ee4032d6176dc68aa436fa417e7a1f708c80e79c Mon Sep 17 00:00:00 2001 From: Chris Collins Date: Wed, 22 May 2024 11:56:09 -1000 Subject: [PATCH] adjusting goreleaser configuration Signed-off-by: Chris Collins --- .goreleaser.yaml | 13 +++++++++---- Makefile | 15 +++++++++++---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 8638191..76ca0b2 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -5,6 +5,7 @@ version: 1 +project_name: 'ocm-container' before: hooks: # You may remove this if you don't use go modules. @@ -15,6 +16,7 @@ before: builds: - env: - CGO_ENABLED=0 + - "GOFLAGS=-mod=readonly -trimpath" # trimpath helps with producing verifiable binaries goos: - linux - darwin @@ -32,10 +34,13 @@ archives: {{- else if eq .Arch "386" }}i386 {{- else }}{{ .Arch }}{{ end }} {{- if .Arm }}v{{ .Arm }}{{ end }} - # use zip for windows archives - format_overrides: - - goos: windows - format: zip + +checksum: + name_template: 'sha256sum.txt' + algorithm: sha256 + +snapshot: + name_template: "{{ .Tag }}-next" changelog: sort: asc diff --git a/Makefile b/Makefile index 0c9016d..5ac9bf1 100644 --- a/Makefile +++ b/Makefile @@ -38,9 +38,12 @@ export CGO_ENABLED=0 GOLANGCI_LINT_VERSION=v1.51.2 GORELEASER_VERSION=v1.24.0 -# TODO: Setup token for goreleaser -export GITHUB_TOKEN?= +GORELEASER_CONFIG=.goreleaser.yaml +# Number of cores to use when building assets +GORELEASER_CORES=4 +GORELEASER_ADDITIONAL_ARGS= +export GITHUB_TOKEN?= .Phony: checkEnv checkEnv: @@ -132,11 +135,15 @@ lint: .PHONY: release release: - goreleaser release --clean +ifndef GITHUB_TOKEN + $(error GITHUB_TOKEN is undefined) +endif + goreleaser check --config $(GORELEASER_CONFIG) + goreleaser release --clean --config $(GORELEASER_CONFIG) --parallelism $(GORELEASER_CORES) $(GORELEASER_ADDITIONAL_ARGS) .PHONY: build-snapshot build-snapshot: - goreleaser build --clean --snapshot --single-target=true + goreleaser build --clean --snapshot --single-target=true --config $(GORELEASER_CONFIG) .PHONY: fmt fmt: