4848 echo tag=$(git describe --tags) >> $GITHUB_OUTPUT
4949 while read branchname
5050 do
51- #branchname looks like 'develop' or 'r/17.x', the describe + cut looks like '17.x', so we prefix with r/
52- # NB: branchname == develop *should not match* anything so that we fall back to the if case below
51+ LAST_BRANCH="$branchname"
52+ #branchname looks like 'r/17.x', the describe + cut looks like '17.x', so we prefix with r/
53+ # NB: branchname == develop is not handled here, it's handled below
5354 if [ "$branchname" != "r/`git describe --tags | cut -f 1 -d -`" ]; then
5455 continue
5556 fi
@@ -61,10 +62,15 @@ jobs:
6162 -H "Accept: application/vnd.github+json" \
6263 -H "X-GitHub-Api-Version: 2022-11-28" \
6364 /repos/${{ github.repository_owner }}/opencast/branches?per_page=100 | \
64- jq -r '. | map(select(.name | match("r/[0-9]*.x|develop"))) | .[].name'`
65- if [ -z "${BASE_BRANCH}" ]; then
66- echo "Base branch is develop"
67- echo "branch=develop" >> $GITHUB_OUTPUT
65+ jq -r '. | map(select(.name | match("r/[0-9]*.x"))) | .[].name'`
66+ #Figure out what develop branch's version should be
67+ # Bash is, without a doubt, the worst possible way to do this, but here we are...
68+ export DEVELOP_BRANCH=$(($(echo $LAST_BRANCH | cut -f 2 -d '/' | cut -f 1 -d '.') + 1)).x
69+ #If we didn't find a match above, *and* the develop branch matches the tag
70+ if [ -z "${BASE_BRANCH}" -a "$DEVELOP_BRANCH" == "`git describe --tags | cut -f 1 -d -`" ]; then
71+ echo "Base branch is develop, version $DEVELOP_BRANCH"
72+ # Develop is by definition (LAST_BRANCH + 1).x
73+ echo "branch=$DEVELOP_BRANCH" >> $GITHUB_OUTPUT
6874 fi
6975
7076 - name : Create new release in github
0 commit comments