Skip to content

Commit 6788348

Browse files
lafrikstechknowlogick
authored andcommitted
Fix drone git@next plugin Gitea version display when building tag (#4380) (#4430)
1 parent 1965eaf commit 6788348

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

Makefile

+13-11
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,19 @@ GOFMT ?= gofmt -s
2121
GOFLAGS := -i -v
2222
EXTRA_GOFLAGS ?=
2323

24-
LDFLAGS := -X "main.Version=$(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')" -X "main.Tags=$(TAGS)"
24+
ifneq ($(DRONE_TAG),)
25+
VERSION ?= $(subst v,,$(DRONE_TAG))
26+
GITEA_VERSION := $(VERSION)
27+
else
28+
ifneq ($(DRONE_BRANCH),)
29+
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
30+
else
31+
VERSION ?= master
32+
endif
33+
GITEA_VERSION := $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
34+
endif
35+
36+
LDFLAGS := -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"
2537

2638
PACKAGES ?= $(filter-out code.gitea.io/gitea/integrations,$(shell $(GO) list ./... | grep -v /vendor/))
2739
SOURCES ?= $(shell find . -name "*.go" -type f)
@@ -45,16 +57,6 @@ else
4557
EXECUTABLE := gitea
4658
endif
4759

48-
ifneq ($(DRONE_TAG),)
49-
VERSION ?= $(subst v,,$(DRONE_TAG))
50-
else
51-
ifneq ($(DRONE_BRANCH),)
52-
VERSION ?= $(subst release/v,,$(DRONE_BRANCH))
53-
else
54-
VERSION ?= master
55-
endif
56-
endif
57-
5860
.PHONY: all
5961
all: build
6062

0 commit comments

Comments
 (0)