From 72321152c92d3d4c76c08498b30883b9a74aede2 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Thu, 29 Feb 2024 19:11:33 +0100 Subject: [PATCH] fix(build): binary asset names and build vars (#78) * build(go): remove name_template * fix(build): buildinfo vars --- .goreleaser.yaml | 8 ++------ Dockerfile | 2 +- Dockerfile.ci | 2 +- Makefile | 2 +- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 188ba28..cb3974d 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -30,6 +30,8 @@ builds: goarch: arm64 main: ./cmd/omegabrr/main.go binary: omegabrr + ldflags: + - -s -w -X github.com/autobrr/omegabrr/internal/buildinfo.Version=v{{.Version}} -X github.com/autobrr/omegabrr/internal/buildinfo.Commit={{.Commit}} -X github.com/autobrr/omegabrr/internal/buildinfo.Date={{.Date}} -X github.com/autobrr/omegabrr/internal/buildinfo.BuiltBy=goreleaser' archives: - id: omegabrr @@ -38,12 +40,6 @@ archives: format_overrides: - goos: windows format: zip - name_template: >- - {{ .ProjectName }}_ - {{- .Version }}_ - {{- .Os }}_ - {{- if eq .Arch "amd64" }}x86_64 - {{- else }}{{ .Arch }}{{ end }} release: prerelease: auto diff --git a/Dockerfile b/Dockerfile index a410380..341b619 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,7 +19,7 @@ COPY . ./ #ENV GOOS=linux ENV CGO_ENABLED=0 -RUN go build -ldflags "-s -w -X buildinfo.Version=${VERSION} -X buildinfo.Commit=${REVISION} -X buildinfo.Date=${BUILDTIME}" -o bin/omegabrr cmd/omegabrr/main.go +RUN go build -ldflags "-s -w -X github.com/autobrr/omegabrr/internal/buildinfo.Version=${VERSION} -X github.com/autobrr/omegabrr/internal/buildinfo.Commit=${REVISION} -X github.com/autobrr/omegabrr/internal/buildinfo.Date=${BUILDTIME}" -o bin/omegabrr cmd/omegabrr/main.go # build runner FROM alpine:latest diff --git a/Dockerfile.ci b/Dockerfile.ci index 2915e74..03a8078 100644 --- a/Dockerfile.ci +++ b/Dockerfile.ci @@ -24,7 +24,7 @@ export GOARCH=$TARGETARCH; \ [[ "$GOARCH" == "arm" ]] && [[ "$TARGETVARIANT" == "v6" ]] && export GOARM=6; \ [[ "$GOARCH" == "arm" ]] && [[ "$TARGETVARIANT" == "v7" ]] && export GOARM=7; \ echo $GOARCH $GOOS $GOARM$GOAMD64; \ -go build -ldflags "-s -w -X buildinfo.Version=${VERSION} -X buildinfo.Commit=${REVISION} -X buildinfo.Date=${BUILDTIME}" -o /out/bin/omegabrr cmd/omegabrr/main.go +go build -ldflags "-s -w -X github.com/autobrr/omegabrr/internal/buildinfo.Version=${VERSION} -X github.com/autobrr/omegabrr/internal/buildinfo.Commit=${REVISION} -X github.com/autobrr/omegabrr/internal/buildinfo.Date=${BUILDTIME}" -o /out/bin/omegabrr cmd/omegabrr/main.go # build runner FROM alpine:latest AS runner diff --git a/Makefile b/Makefile index c7de4fb..ea342ce 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ GIT_TAG := $(shell git tag --points-at HEAD 2> /dev/null | head -n 1) GO ?= go RM ?= rm -GOFLAGS ?= "-X buildinfo.Commit=$(GIT_COMMIT) -X buildinfo.Version=$(GIT_TAG)" +GOFLAGS ?= "-X github.com/autobrr/omegabrr/internal/buildinfo.Commit=$(GIT_COMMIT) -X github.com/autobrr/omegabrr/internal/buildinfo.Version=$(GIT_TAG)" PREFIX ?= /usr/local BINDIR ?= bin