Skip to content

Commit

Permalink
may we fix previous_tags?
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhuda committed Aug 4, 2024
1 parent 64d5227 commit 793775e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,15 @@ jobs:
id: get_previous_tag
run: |
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
PREVIOUS_TAG=$(git tag -l | sed -n '$!p' | tail -n 1)
# Get all tags, sort them semantically, and find the previous one
PREVIOUS_TAG=$(git tag --sort=-v:refname | grep -E '^v' | awk -v current_tag="${VERSION}" '{
if ($0 == current_tag) {
found = 1; next
}
if (found) {
print $0; exit
}
}')
echo "PREVIOUS_TAG=${PREVIOUS_TAG}" >> $GITHUB_ENV
fi
Expand Down

0 comments on commit 793775e

Please sign in to comment.