We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 691042b commit 0f39005Copy full SHA for 0f39005
.github/workflows/github-release.yml
@@ -29,18 +29,24 @@ jobs:
29
fi
30
echo "tag=$TAG_NAME" >> $GITHUB_ENV
31
32
- - name: Get previous tag
+ - name: Get previous tag (SemVer sorting)
33
id: previous_tag
34
run: |
35
- TAGS=($(git tag --sort=-creatordate))
+ # Get all tags and sort them by SemVer (ignoring "v" prefix)
36
+ TAGS=($(git tag -l | sort -V))
37
+
38
+ # Get the current tag
39
CURRENT="${{ env.tag }}"
40
PREV=""
41
42
+ # Loop through sorted tags to find the previous one
43
for i in "${!TAGS[@]}"; do
- if [[ "${TAGS[i]}" == "$CURRENT" && $i -lt $((${#TAGS[@]} - 1)) ]]; then
- PREV="${TAGS[i+1]}"
44
+ if [[ "${TAGS[i]}" == "$CURRENT" && $i -gt 0 ]]; then
45
+ PREV="${TAGS[i-1]}"
46
break
47
48
done
49
50
echo "previous=$PREV" >> $GITHUB_ENV
51
52
- name: Create GitHub Release
0 commit comments