mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-21 08:31:27 -05:00
add make version on gitea version (#6485)
This commit is contained in:
parent
60ba903a57
commit
0a8e63c682
2 changed files with 18 additions and 9 deletions
4
Makefile
4
Makefile
|
@ -24,6 +24,8 @@ GOFMT ?= gofmt -s
|
||||||
GOFLAGS := -i -v
|
GOFLAGS := -i -v
|
||||||
EXTRA_GOFLAGS ?=
|
EXTRA_GOFLAGS ?=
|
||||||
|
|
||||||
|
MAKE_VERSION := $(shell make -v | head -n 1)
|
||||||
|
|
||||||
ifneq ($(DRONE_TAG),)
|
ifneq ($(DRONE_TAG),)
|
||||||
VERSION ?= $(subst v,,$(DRONE_TAG))
|
VERSION ?= $(subst v,,$(DRONE_TAG))
|
||||||
GITEA_VERSION ?= $(VERSION)
|
GITEA_VERSION ?= $(VERSION)
|
||||||
|
@ -36,7 +38,7 @@ else
|
||||||
GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LDFLAGS := -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
|
LDFLAGS := -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
|
||||||
|
|
||||||
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/)))
|
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations/migration-test,$(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/)))
|
||||||
SOURCES ?= $(shell find . -name "*.go" -type f)
|
SOURCES ?= $(shell find . -name "*.go" -type f)
|
||||||
|
|
23
main.go
23
main.go
|
@ -23,11 +23,14 @@ import (
|
||||||
"github.com/urfave/cli"
|
"github.com/urfave/cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version holds the current Gitea version
|
var (
|
||||||
var Version = "1.5.0-dev"
|
// Version holds the current Gitea version
|
||||||
|
Version = "1.9.0-dev"
|
||||||
// Tags holds the build tags used
|
// Tags holds the build tags used
|
||||||
var Tags = ""
|
Tags = ""
|
||||||
|
// MakeVersion holds the current Make version if built with make
|
||||||
|
MakeVersion = ""
|
||||||
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setting.AppVer = Version
|
setting.AppVer = Version
|
||||||
|
@ -60,10 +63,14 @@ arguments - which can alternatively be run by running the subcommand web.`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func formatBuiltWith(Tags string) string {
|
func formatBuiltWith(makeTags string) string {
|
||||||
|
var version = runtime.Version()
|
||||||
|
if len(MakeVersion) > 0 {
|
||||||
|
version = MakeVersion + ", " + runtime.Version()
|
||||||
|
}
|
||||||
if len(Tags) == 0 {
|
if len(Tags) == 0 {
|
||||||
return " built with " + runtime.Version()
|
return " built with " + version
|
||||||
}
|
}
|
||||||
|
|
||||||
return " built with " + runtime.Version() + " : " + strings.Replace(Tags, " ", ", ", -1)
|
return " built with " + version + " : " + strings.Replace(Tags, " ", ", ", -1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue