Skip to content

Commit 2ba6b25

Browse files
committed
Update .goreleaser.yml, Makefile, VERSION and main.go to include version number
1 parent a2202fd commit 2ba6b25

File tree

4 files changed

+12
-1
lines changed

4 files changed

+12
-1
lines changed

.goreleaser.yml

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ before:
44
builds:
55
- env:
66
- CGO_ENABLED=0
7+
ldflags:
8+
- -X main.version={{ .Version }}
79
goos:
810
- darwin
911
- linux
@@ -31,6 +33,8 @@ changelog:
3133
filters:
3234
exclude:
3335
- typo
36+
- "^test:"
3437
release:
3538
prerelease: auto
3639
mode: append
40+
draft: false

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PREFIX ?= /usr/local
2-
VERSION ?= $(shell git describe --tags --dirty --always | sed -e 's/^v//')
2+
VERSION ?= $(shell git describe --tags --abbrev=0)
33

44
.PHONY: go-install
55
go-install:

VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.0.4

main.go

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package main
22

33
import (
4+
_ "embed"
45
"flag"
56
"fmt"
67
"os"
@@ -10,6 +11,9 @@ import (
1011
"github.com/zaidfadhil/kemit/git"
1112
)
1213

14+
//go:embed VERSION
15+
var version string
16+
1317
func main() {
1418
cfg := &config.Config{}
1519
err := cfg.Load() //nolint:errcheck
@@ -23,6 +27,8 @@ func main() {
2327
if err != nil {
2428
end(err)
2529
}
30+
} else if os.Args[1] == "version" {
31+
fmt.Printf("kemit version: %s", version)
2632
}
2733
} else {
2834
err = cfg.Validate()

0 commit comments

Comments
 (0)