[CI] read STORED_VERSION_FILE if available

This is a regression and there should be a test verifying the
version is right when running from a source tarbal which relies on
that file.

(cherry picked from commit ed39857c17)
(cherry picked from commit 772fd8e716)
(cherry picked from commit 109dcb3740)
This commit is contained in:
Earl Warren 2023-06-23 17:19:44 +02:00
parent ba453920aa
commit 6827c2c57a
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -79,7 +79,13 @@ endif
STORED_VERSION_FILE := VERSION
HUGO_VERSION ?= 0.111.3
STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null)
ifneq ($(STORED_VERSION),)
GITEA_VERSION ?= $(STORED_VERSION)
else
GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//')
endif
VERSION = ${GITEA_VERSION}
LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)"