From a20b9c62b6ed4e268ec01df333665c68fe8758fc Mon Sep 17 00:00:00 2001 From: Davidson Bruno Date: Thu, 25 Apr 2024 04:44:45 -0300 Subject: [PATCH] fix: filtered get last version to ignore 'v' pattern --- actions/latest-version-obtaining/latest-version-obtaining.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/actions/latest-version-obtaining/latest-version-obtaining.sh b/actions/latest-version-obtaining/latest-version-obtaining.sh index 4fa139e..00f3a1b 100755 --- a/actions/latest-version-obtaining/latest-version-obtaining.sh +++ b/actions/latest-version-obtaining/latest-version-obtaining.sh @@ -1,10 +1,10 @@ #!/bin/bash # Fetch tags from remote. -git fetch --unshallow origin --tags > /dev/null 2>&1 || { echo "Failed to fetch tags from remote."; exit 1; } +git fetch origin --tags > /dev/null 2>&1 || { echo "Failed to fetch tags from remote."; exit 1; } # Get the last repository tag. -last_version=$(git describe --tags --abbrev=0 2>/dev/null) +last_version=$(git tag --sort=version:refname | grep -v '^v' | tail -n 1) if [ -z "$last_version" ]; then echo "No found version associated with this branch."