From a88da30a5639d4ff24a50fa4bc9a69b6dee4ee71 Mon Sep 17 00:00:00 2001 From: Skydust Date: Wed, 25 Dec 2024 19:12:46 +0100 Subject: [PATCH] Added a better way to get the last tag --- action.yml | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index bbe9a9e..e5654c4 100644 --- a/action.yml +++ b/action.yml @@ -19,14 +19,24 @@ runs: using: composite steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 # Include full history with tags - name: Get new version run: | - last_version="$(git describe --tags --match "v*" --abbrev=0 || echo "")" + git -c 'versionsort.suffix=-' ls-remote --tags -q --refs --sort '-v:refname' + + git -c 'versionsort.suffix=-' ls-remote --tags -q --refs --sort '-v:refname' | head -n 1 | cut -d "/" -f3 + echo Test + first=$(git -c 'versionsort.suffix=-' ls-remote --tags -q --refs --sort '-v:refname') + echo $first + second=$(echo "$first" | head -n 1) + log_info $second + third=$(echo "$second" | cut -d "/" -f3) + log_info $third + last_version="$(git -c 'versionsort.suffix=-' ls-remote --tags -q --refs --sort '-v:refname' | head -n 1 | cut -d "/" -f3 || echo "")" + log_info Hello if [[ -z "$last_version" ]]; then last_version="v0.0.0" fi + log_info HelloWw last_version="${last_version:1}" log_info "Last version: ${last_version}"