Skip to content

Commit

Permalink
Add git SHA to goreleser binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
rubiojr committed Nov 5, 2021
1 parent b876502 commit f7b970c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ before:
builds:
- id: "swamp"
binary: swamp
ldflags: -s -w
ldflags: -s -w -X github.com/swampapp/swamp/internal/version.GIT_SHA={{.ShortCommit}}
goos:
- linux
goarch:
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ release: swampd swamp swp

${BINNAME}: swampd swp
./script/compile-resources
go build -ldflags="-s -w -X 'main.GIT_SHA=$(shell git rev-parse --short HEAD)'" -o ${BINNAME}
go build -ldflags="-s -w -X 'github.com/swampapp/swamp/internal/version.GIT_SHA=$(shell git rev-parse --short HEAD)'" -o ${BINNAME}

swampd:
go build -ldflags="-s -w -X 'main.GIT_SHA=$(shell git rev-parse --short HEAD)'" -o swampd ./cmd/swampd
go build -ldflags="-s -w -X 'github.com/swampapp/swamp/internal/version.GIT_SHA=$(shell git rev-parse --short HEAD)'" -o swampd ./cmd/swampd

swp:
go build -ldflags="-s -w -X 'main.GIT_SHA=$(shell git rev-parse --short HEAD)'" -o swp ./cmd/swp
go build -ldflags="-s -w -X 'github.com/swampapp/swamp/internal/version.GIT_SHA=$(shell git rev-parse --short HEAD)'" -o swp ./cmd/swp

clean:
rm -f ${BINNAME} swampd swp
Expand Down

0 comments on commit f7b970c

Please sign in to comment.