Skip to content

Commit 62405a3

Browse files
authored
fix: release job isn't respecting minor latest streams (#3405)
Signed-off-by: xstefank <xstefank122@gmail.com>
1 parent 5a8fd0a commit 62405a3

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,27 @@ 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+
MAIN_POM_VERSION=$(curl -fsSL "https://raw.githubusercontent.com/${{ github.repository }}/main/pom.xml" | yq -p xml '.project.version')
39+
if [ -z "$MAIN_POM_VERSION" ]; then
40+
echo "Failed to determine main branch POM version"
41+
exit 1
42+
fi
43+
MAIN_MAJOR_MINOR=$(echo "$MAIN_POM_VERSION" | cut -d. -f1-2)
44+
45+
echo "Release tag major.minor: $RELEASE_MAJOR_MINOR"
46+
echo "Main branch major.minor: $MAIN_MAJOR_MINOR"
47+
48+
if [ "$RELEASE_MAJOR_MINOR" = "$MAIN_MAJOR_MINOR" ]; then
49+
echo "Setting version_branch to main"
50+
echo "tmp_version_branch=main" >> "$GITHUB_ENV"
51+
else
52+
echo "Setting version_branch to ${RELEASE_MAJOR_MINOR}.x"
53+
echo "tmp_version_branch=${RELEASE_MAJOR_MINOR}.x" >> "$GITHUB_ENV"
54+
fi
3655
- if: ${{ env.tmp_version_branch == '' }}
3756
name: Fail if version_branch is not set
3857
run: |

0 commit comments

Comments
 (0)