[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`
This commit is contained in:
Earl Warren 2024-02-11 15:36:58 +01:00
parent 7b4dba3aa0
commit db3b867b02
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00

View file

@ -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)"