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.
This commit is contained in:
ShahanaFarooqui 2024-08-31 14:32:13 -07:00
parent ad37328600
commit 1a71e15cf3
3 changed files with 5 additions and 5 deletions

View File

@ -37,13 +37,13 @@ jobs:
- name: Check version tag - name: Check version tag
run: >- run: >-
git describe --always --dirty=-modded --abbrev=7 git describe --tags --always --dirty=-modded --abbrev=7
- name: Setup Version - name: Setup Version
env: env:
WORKDIR: ${{ matrix.WORKDIR }} WORKDIR: ${{ matrix.WORKDIR }}
run: | 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 - name: Set up values
id: set-values id: set-values
@ -90,7 +90,7 @@ jobs:
run: | run: |
echo "POETRY VERSION PUBLISH: $(poetry --version)" echo "POETRY VERSION PUBLISH: $(poetry --version)"
cd ${{ env.WORKDIR }} cd ${{ env.WORKDIR }}
export VERSION=$(git describe --abbrev=0) export VERSION=$(git describe --tags --abbrev=0)
echo "Pyln VERSION: $VERSION" echo "Pyln VERSION: $VERSION"
make upgrade-version NEW_VERSION=$VERSION make upgrade-version NEW_VERSION=$VERSION
python3 -m pip config set global.timeout 150 python3 -m pip config set global.timeout 150

View File

@ -1,7 +1,7 @@
#! /usr/bin/make #! /usr/bin/make
# Extract version from git, or if we're from a zipfile, use dirname # 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. # Next release.
CLN_NEXT_VERSION := v24.08 CLN_NEXT_VERSION := v24.08

View File

@ -54,7 +54,7 @@ else
fi fi
PLATFORM="$OS"-"$VER" 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" # eg. ## [0.6.3] - 2019-01-09: "The Smallblock Conspiracy"
# Skip 'v' here in $VERSION # Skip 'v' here in $VERSION