Skip to content

Commit 3def2b8

Browse files
committed
fix: release job isn't respecting minor latest streams
Signed-off-by: xstefank <xstefank122@gmail.com>
1 parent 1affd7d commit 3def2b8

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,22 @@ jobs:
3131
echo "tmp_version_branch=v4" >> "$GITHUB_ENV"
3232
- if: ${{ startsWith(github.event.release.tag_name, 'v5.' ) }}
3333
run: |
34-
echo "Setting version_branch to main"
35-
echo "tmp_version_branch=main" >> "$GITHUB_ENV"
34+
RELEASE_VERSION="${{ github.event.release.tag_name }}"
35+
RELEASE_VERSION="${RELEASE_VERSION#v}"
36+
RELEASE_MAJOR_MINOR=$(echo "$RELEASE_VERSION" | cut -d. -f1-2)
37+
38+
# getting this version from POM would require pulling the whole repo
39+
MAIN_POM_VERSION=$(curl -s "https://raw.githubusercontent.com/${{ github.repository }}/main/pom.xml" | grep -oPm1 '(?<=<version>)[^<]+')
40+
MAIN_MAJOR_MINOR=$(echo "$MAIN_POM_VERSION" | cut -d. -f1-2)
41+
42+
echo "Release tag major.minor: $RELEASE_MAJOR_MINOR"
43+
echo "Main branch major.minor: $MAIN_MAJOR_MINOR"
44+
45+
if [ "$RELEASE_MAJOR_MINOR" = "$MAIN_MAJOR_MINOR" ]; then
46+
echo "tmp_version_branch=main" >> "$GITHUB_ENV"
47+
else
48+
echo "tmp_version_branch=${RELEASE_MAJOR_MINOR}.x" >> "$GITHUB_ENV"
49+
fi
3650
- if: ${{ env.tmp_version_branch == '' }}
3751
name: Fail if version_branch is not set
3852
run: |

0 commit comments

Comments
 (0)