Browse Source

include git tag in binary when available

tags/v2.8.0-rc1
Shivaram Lingamneni 2 years ago
parent
commit
f9ca172ad7
1 changed files with 3 additions and 2 deletions
  1. 3
    2
      Makefile

+ 3
- 2
Makefile View File

@@ -1,16 +1,17 @@
1 1
 .PHONY: all install build release capdefs test smoke gofmt irctest
2 2
 
3 3
 GIT_COMMIT := $(shell git rev-parse HEAD 2> /dev/null)
4
+GIT_TAG := $(shell git tag --points-at HEAD 2> /dev/null | head -n 1)
4 5
 
5 6
 capdef_file = ./irc/caps/defs.go
6 7
 
7 8
 all: install
8 9
 
9 10
 install:
10
-	go install -v -ldflags "-X main.commit=$(GIT_COMMIT)"
11
+	go install -v -ldflags "-X main.commit=$(GIT_COMMIT) -X main.version=$(GIT_TAG)"
11 12
 
12 13
 build:
13
-	go build -v -ldflags "-X main.commit=$(GIT_COMMIT)"
14
+	go build -v -ldflags "-X main.commit=$(GIT_COMMIT) -X main.version=$(GIT_TAG)"
14 15
 
15 16
 release:
16 17
 	goreleaser --skip-publish --rm-dist

Loading…
Cancel
Save