File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 : |
You can’t perform that action at this time.
0 commit comments