Skip to content

Commit 91a7d2c

Browse files
committed
ci: Change logic to get previous tag version
1 parent 05b587f commit 91a7d2c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/build-binaries.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,22 @@ jobs:
1717
- name: Checkout Code
1818
uses: actions/checkout@v4
1919
with:
20-
fetch-tags: true
20+
fetch-depth: 0
2121
ref: cats-${{ github.event.inputs.releaseversion }}
2222

2323
- name: Get Previous Tag
2424
id: get_previous_tag
2525
run: |
26-
TAGS=$(git tag --sort=-creatordate)
2726
CURRENT_TAG=${GITHUB_REF#refs/tags/}
28-
PREVIOUS_TAG=$(echo "$TAGS" | grep -B 1 "$CURRENT_TAG" | head -n 1)
27+
echo "CURRENT_TAG=$CURRENT_TAG"
28+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 $CURRENT_TAG^)
29+
echo "PREVIOUS_TAG=$PREVIOUS_TAG"
2930
echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_ENV
30-
31+
3132
- name: Generate Changelog
3233
id: generate_changelog
3334
run: |
35+
echo "Generating changelog from ${{ env.PREVIOUS_TAG }} to ${{ github.ref_name }}"
3436
CHANGELOG=$(git log ${{ env.PREVIOUS_TAG }}..${{ github.ref_name }} --pretty=format:"* %s" --no-merges | grep -vE "\[maven-release-plugin\]|chore:|docs:|test:|ci:|build:")
3537
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
3638
echo "$CHANGELOG" >> $GITHUB_ENV

0 commit comments

Comments
 (0)