From 10fcb55507339767863757ffaa4ae5b0e5b94c89 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Mon, 19 Jun 2023 23:07:51 -0400 Subject: [PATCH] Fetch all git data for embedding correct version in docker image (#25361) (#25373) Backport #25361 by @techknowlogick Fix #25350 Co-authored-by: techknowlogick --- .github/workflows/release-nightly.yml | 3 +++ Makefile | 3 +++ 2 files changed, 6 insertions(+) diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 71ec6dae84..1868673f17 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -55,6 +55,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + # fetch all commits instead of only the last as some branches are long lived and could have many between versions + # fetch all tags to ensure that "git describe" reports expected Gitea version, eg. v1.21.0-dev-1-g1234567 + - run: git fetch --unshallow --quiet --tags --force - uses: docker/setup-qemu-action@v2 - uses: docker/setup-buildx-action@v2 - name: Get cleaned branch name diff --git a/Makefile b/Makefile index 3a1887fba1..ecd7a2d80c 100644 --- a/Makefile +++ b/Makefile @@ -79,6 +79,9 @@ endif STORED_VERSION_FILE := VERSION HUGO_VERSION ?= 0.111.3 +GITHUB_REF_TYPE ?= branch +GITHUB_REF_NAME ?= $(shell git rev-parse --abbrev-ref HEAD) + ifneq ($(GITHUB_REF_TYPE),branch) VERSION ?= $(subst v,,$(GITHUB_REF_NAME)) GITEA_VERSION ?= $(GITHUB_REF_NAME)