Skip to content

Commit 61ea91e

Browse files
committed
Autogenerate Version On Build
1 parent d07c955 commit 61ea91e

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ BINDATA := $(shell find conf | sed 's/ /\\ /g')
99
STYLESHEETS := $(wildcard public/less/index.less public/less/_*.less)
1010
JAVASCRIPTS :=
1111

12+
VERSION = $(shell git describe --tags --always)
13+
14+
LDFLAGS += -X "code.gitea.io/gitea.Version=$(VERSION)"
1215
LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildTime=$(DATE)"
1316
LDFLAGS += -X "code.gitea.io/gitea/modules/setting.BuildGitHash=$(SHA)"
1417

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
)
1919

2020
// Version holds the current Gitea version
21-
const Version = "0.9.99.0915"
21+
var Version = "v0.0.0"
2222

2323
func init() {
2424
runtime.GOMAXPROCS(runtime.NumCPU())

modules/setting/setting.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,6 @@ const (
5353

5454
// settings
5555
var (
56-
// BuildTime information should only be set by -ldflags.
57-
BuildTime string
58-
BuildGitHash string
59-
6056
// AppVer settings
6157
AppVer string
6258
AppName string
@@ -642,11 +638,6 @@ var logLevels = map[string]string{
642638
func newLogService() {
643639
log.Info("%s %s", AppName, AppVer)
644640

645-
if len(BuildTime) > 0 {
646-
log.Info("Build Time: %s", BuildTime)
647-
log.Info("Build Git Hash: %s", BuildGitHash)
648-
}
649-
650641
// Get and check log mode.
651642
LogModes = strings.Split(Cfg.Section("log").Key("MODE").MustString("console"), ",")
652643
LogConfigs = make([]string, len(LogModes))

0 commit comments

Comments
 (0)