build-lxd.yml: Fix discovery of previous tag when running on tag

Signed-off-by: thecalcaholic <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
thecalcaholic 2022-09-14 19:05:47 +02:00
parent ea7c6aa299
commit f9c5c61be5
No known key found for this signature in database
GPG Key ID: 3510056072886A8F

View File

@ -79,7 +79,10 @@ jobs:
then
version="master"
else
git fetch -fu --tags origin ${{ env.VERSION }}:${{ env.VERSION }}
if [[ "${{ github.ref_type }}" != "tag ]] || ! git describe --tags > /dev/null
then
git fetch -fu --tags origin ${{ env.VERSION }}:${{ env.VERSION }}
fi
version="$(git describe --tags)"
[[ "$version" =~ .*-.*-.* ]] || {
git checkout HEAD~1