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+ # 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 : |
You can’t perform that action at this time.
0 commit comments