From 6827c2c57a651b8dd4d7f1f509b24f86bb5db82d Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Fri, 23 Jun 2023 17:19:44 +0200 Subject: [PATCH] [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 ed39857c170a8b72d6c5e78ec447f4344f816cf6) (cherry picked from commit 772fd8e716f52b5735d7e78a19e6e81af15478a5) (cherry picked from commit 109dcb3740d3c1044cf374413a03ae48a2c1d8c1) --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index dd002d9108..9e7036566b 100644 --- a/Makefile +++ b/Makefile @@ -79,7 +79,13 @@ endif STORED_VERSION_FILE := VERSION HUGO_VERSION ?= 0.111.3 -GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//') + +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)"