From db3b867b0272b17084ce6485000e8a8f38666c41 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 11 Feb 2024 15:36:58 +0100 Subject: [PATCH] [RELEASE] Gitea version is for interoperability only Forgejo now has its own lifecycle and its version is derived from the tag. The Gitea tags are no longer found in the Forgejo codebase and can no longer be used for that purpose. When a Forgejo release is published, for interoperability with the existing tools in the ecosystem, it advertises the supported Gitea version via /api/v1/version. It is set in the Makefile manually and cannot be automatically set. https://codeberg.org/forgejo-contrib/delightful-forgejo#packaging Existing Forgejo packages rely on the Makefile to build and the change must be done in a way that tries to not break their assumptions. From the point of view of a Forgejo package build, the following will happen on the next major release: - The package version will bump from v1.21.x to v7.0.0 - /api/v1/version will bump from v1.21.x to v1.22.0 - /api/forgejo/v1/version will bump from v6.x to v7.0.0 The Makefile uses the following variables: GITEA_VERSION is returned by /api/v1/version FORGEJO_VERSION is returned by /api/forgejo/v1/version VERSION is used in the name the binary file and the source archive Before: GITEA_VERSION is the computed version FORGEJO_VERSION is set manually VERSION defaults to GITEA_VERSION After: FORGEJO_VERSION is the computed version GITEA_VERSION is set manually VERSION defaults to FORGEJO_VERSION When the version is computed, it comes from: - The content of the VERSION file if it exists. It is inserted in the source archive because it does not contain a git repository - Otherwise the output of `git describe` --- Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6ef4c521c9..ce854272bc 100644 --- a/Makefile +++ b/Makefile @@ -88,14 +88,13 @@ HUGO_VERSION ?= 0.111.3 STORED_VERSION=$(shell cat $(STORED_VERSION_FILE) 2>/dev/null) ifneq ($(STORED_VERSION),) - GITEA_VERSION ?= $(STORED_VERSION) + FORGEJO_VERSION ?= $(STORED_VERSION) else - GITEA_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//') + FORGEJO_VERSION ?= $(shell git describe --tags --always | sed 's/-/+/' | sed 's/^v//') endif -VERSION = ${GITEA_VERSION} +VERSION ?= ${FORGEJO_VERSION} -# SemVer -FORGEJO_VERSION := 7.0.0+0-gitea-1.22.0 +GITEA_VERSION ?= 1.22.0 LDFLAGS := $(LDFLAGS) -X "main.MakeVersion=$(MAKE_VERSION)" -X "main.Version=$(GITEA_VERSION)" -X "main.Tags=$(TAGS)" -X "main.ForgejoVersion=$(FORGEJO_VERSION)"