From 55ba4eb20c84d6af407a2d7bc0b80f3e28647696 Mon Sep 17 00:00:00 2001 From: "Jonas I. Liechti" Date: Thu, 23 May 2024 19:11:06 +0200 Subject: [PATCH] fix: fetching correct tag for previous version --- .github/workflows/initiate_version_release.yml | 2 +- .github/workflows/publish_version_enforce.yml | 2 +- .github/workflows/publish_version_merging.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/initiate_version_release.yml b/.github/workflows/initiate_version_release.yml index 7c229e20..a3b1c2ea 100644 --- a/.github/workflows/initiate_version_release.yml +++ b/.github/workflows/initiate_version_release.yml @@ -46,7 +46,7 @@ jobs: # first fetch all the tags git fetch --filter=tree:0 origin +refs/tags/*:refs/tags/* echo "VERSION=`echo $(echo '${{ github.ref_name }}'|grep -Eo '[0-9]+.[0-9]+.[0-9]+')`" >> $GITHUB_OUTPUT - echo "PREVIOUS_VERSION=`echo $(git tag --list | grep -E '[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT + echo "PREVIOUS_VERSION=`echo $(git tag --list --sort=version:refname | grep -E '^[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT echo "AUTHOR=`echo $(git log -1 --pretty=%an)`" >> $GITHUB_OUTPUT - name: Get git-chglog and update CHANGELOG run: | diff --git a/.github/workflows/publish_version_enforce.yml b/.github/workflows/publish_version_enforce.yml index 3f78147e..d6dd4c53 100644 --- a/.github/workflows/publish_version_enforce.yml +++ b/.github/workflows/publish_version_enforce.yml @@ -148,7 +148,7 @@ jobs: run: | git fetch --filter=tree:0 origin +refs/tags/*:refs/tags/* echo "VERSION=$(echo ${{ github.ref_name }}|grep -Eo '[0-9]+.[0-9]+.[0-9]+')" >> $GITHUB_OUTPUT - echo "PREVIOUS_VERSION=`echo $(git tag --list | grep -E '[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT + echo "PREVIOUS_VERSION=`echo $(git tag --list --sort=version:refname | grep -E '^[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT cat $GITHUB_OUTPUT - name: Remove previous releases of the target tag, if existing # 2 run: | diff --git a/.github/workflows/publish_version_merging.yml b/.github/workflows/publish_version_merging.yml index f7d105f0..7df6b717 100644 --- a/.github/workflows/publish_version_merging.yml +++ b/.github/workflows/publish_version_merging.yml @@ -135,7 +135,7 @@ jobs: run: | git fetch --filter=tree:0 origin +refs/tags/*:refs/tags/* echo "VERSION=$(echo ${{ github.head_ref }}|grep -Eo '[0-9]+.[0-9]+.[0-9]+')" >> $GITHUB_OUTPUT - echo "PREVIOUS_VERSION=`echo $(git tag --list | grep -E '[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT + echo "PREVIOUS_VERSION=`echo $(git tag --list --sort=version:refname | grep -E '^[0-9]+.[0-9]+.[0-9]+$' | tail -n1)`" >> $GITHUB_OUTPUT - name: Remove previous releases of the target tag, if existing if: ${{ steps.published.outputs.labeled == 'false' }} run: |