From 7990e0ce0d10aac5009cffdc3054decebcc7c650 Mon Sep 17 00:00:00 2001 From: ShahanaFarooqui Date: Sat, 31 Aug 2024 14:32:13 -0700 Subject: [PATCH] github: Read tag on HEAD in Github Actions Running `git describe` in local setup correctly identifies the tag available on the tag. But `docker buildx` via actions does not identify it without `--tags` param. Reference Issue: https://github.com/ElementsProject/lightning/issues/7626 Changelog-Fixed: Docker image created via github actions correctly reads the tag available on the HEAD. --- .github/workflows/pypi.yml | 6 +++--- Makefile | 2 +- tools/repro-build.sh | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pypi.yml b/.github/workflows/pypi.yml index b650c4f7b95f..5a45a7dfaa6c 100644 --- a/.github/workflows/pypi.yml +++ b/.github/workflows/pypi.yml @@ -37,13 +37,13 @@ jobs: - name: Check version tag run: >- - git describe --always --dirty=-modded --abbrev=7 + git describe --tags --always --dirty=-modded --abbrev=7 - name: Setup Version env: WORKDIR: ${{ matrix.WORKDIR }} run: | - echo "VERSION=$(git describe --abbrev=0).post$(git describe --abbrev=1 | awk -F "-" '{print $2}')" >> $GITHUB_ENV + echo "VERSION=$(git describe --tags --abbrev=0).post$(git describe --tags --abbrev=1 | awk -F "-" '{print $2}')" >> $GITHUB_ENV - name: Set up values id: set-values @@ -90,7 +90,7 @@ jobs: run: | echo "POETRY VERSION PUBLISH: $(poetry --version)" cd ${{ env.WORKDIR }} - export VERSION=$(git describe --abbrev=0) + export VERSION=$(git describe --tags --abbrev=0) echo "Pyln VERSION: $VERSION" make upgrade-version NEW_VERSION=$VERSION python3 -m pip config set global.timeout 150 diff --git a/Makefile b/Makefile index d4551cf79b70..9ff384bff6d6 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ #! /usr/bin/make # Extract version from git, or if we're from a zipfile, use dirname -VERSION=$(shell git describe --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's|.*/c\{0,1\}lightning-v\{0,1\}\([0-9a-f.rc\-]*\)$$|\1|gp') +VERSION=$(shell git describe --tags --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's|.*/c\{0,1\}lightning-v\{0,1\}\([0-9a-f.rc\-]*\)$$|\1|gp') # Next release. CLN_NEXT_VERSION := v24.08 diff --git a/tools/repro-build.sh b/tools/repro-build.sh index 3b63127c16d5..6c346616c623 100755 --- a/tools/repro-build.sh +++ b/tools/repro-build.sh @@ -54,7 +54,7 @@ else fi PLATFORM="$OS"-"$VER" -VERSION=${FORCE_VERSION:-$(git describe --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's,.*/clightning-\(v[0-9.rc\-]*\)$,\1,p')} +VERSION=${FORCE_VERSION:-$(git describe --tags --always --dirty=-modded --abbrev=7 2>/dev/null || pwd | sed -n 's,.*/clightning-\(v[0-9.rc\-]*\)$,\1,p')} # eg. ## [0.6.3] - 2019-01-09: "The Smallblock Conspiracy" # Skip 'v' here in $VERSION