Skip to content

Commit

Permalink
update gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
shrpne committed Feb 7, 2025
1 parent 691042b commit 0f39005
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,24 @@ jobs:
fi
echo "tag=$TAG_NAME" >> $GITHUB_ENV
- name: Get previous tag
- name: Get previous tag (SemVer sorting)
id: previous_tag
run: |
TAGS=($(git tag --sort=-creatordate))
# Get all tags and sort them by SemVer (ignoring "v" prefix)
TAGS=($(git tag -l | sort -V))
# Get the current tag
CURRENT="${{ env.tag }}"
PREV=""
# Loop through sorted tags to find the previous one
for i in "${!TAGS[@]}"; do
if [[ "${TAGS[i]}" == "$CURRENT" && $i -lt $((${#TAGS[@]} - 1)) ]]; then
PREV="${TAGS[i+1]}"
if [[ "${TAGS[i]}" == "$CURRENT" && $i -gt 0 ]]; then
PREV="${TAGS[i-1]}"
break
fi
done
echo "previous=$PREV" >> $GITHUB_ENV
- name: Create GitHub Release
Expand Down

0 comments on commit 0f39005

Please sign in to comment.