@@ -48,22 +48,28 @@ jobs:
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
5657 echo "Base branch is $branchname"
5758 BASE_BRANCH="$branchname"
58- echo "branch=$branchname " >> $GITHUB_OUTPUT
59+ echo "branch=$BASE_BRANCH " >> $GITHUB_OUTPUT
5960 break
6061 done <<< `gh api \
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"
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_VERSION=$(($(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_VERSION" == "`git describe --tags | cut -f 1 -d -`" ]; then
71+ echo "Base branch is develop, version $DEVELOP_VERSION"
72+ # Develop is by definition (LAST_BRANCH + 1).x
6773 echo "branch=develop" >> $GITHUB_OUTPUT
6874 fi
6975
@@ -100,26 +106,26 @@ jobs:
100106
101107 - name : Clone upstream repository
102108 run : |
103- git clone -b ${{ needs.build.outputs.branch }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast
109+ git clone -b ${{ needs.build-release-tarballs .outputs.branch }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast
104110 cd opencast
105- git checkout -b t/admin-ui-${{ needs.build.outputs.tag }}
111+ git checkout -b t/admin-ui-${{ needs.build-release-tarballs .outputs.tag }}
106112
107113 - name : Update the admin ui pom file
108114 working-directory : opencast
109115 run : |
110- sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>${{ needs.build.outputs.checksum }}</interface.sha256>#" modules/admin-ui-interface/pom.xml
111- sed -i "s#<interface.url>.*</interface.url>#<interface.url>https://github.com/${{ github.repository_owner }}/opencast-admin-interface/releases/download/${{ needs.build.outputs.tag }}/oc-admin-ui-${{ needs.build.outputs.tag }}.tar.gz</interface.url>#" modules/admin-ui-interface/pom.xml
116+ sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>${{ needs.build-release-tarballs .outputs.checksum }}</interface.sha256>#" modules/admin-ui-interface/pom.xml
117+ sed -i "s#<interface.url>.*</interface.url>#<interface.url>https://github.com/${{ github.repository_owner }}/opencast-admin-interface/releases/download/${{ needs.build-release-tarballs .outputs.tag }}/oc-admin-ui-${{ needs.build-release-tarballs .outputs.tag }}.tar.gz</interface.url>#" modules/admin-ui-interface/pom.xml
112118 git add modules/admin-ui-interface/pom.xml
113- git commit -m "Updating admin ui to ${{ needs.build.outputs.tag }}"
114- git push origin t/admin-ui-${{ needs.build.outputs.tag }}
119+ git commit -m "Updating admin ui to ${{ needs.build-release-tarballs .outputs.tag }}"
120+ git push origin t/admin-ui-${{ needs.build-release-tarballs .outputs.tag }}
115121 #This token is an account wide token which allows creation of PRs and pushes.
116122 echo "${{ secrets.MODULE_PR_TOKEN }}" > token.txt
117123 gh auth login --with-token < token.txt
118124 gh pr create \
119- --title "Update ${{ needs.build.outputs.branch }} Admin UI to ${{ needs.build.outputs.tag }}" \
120- --body "Updating Opencast ${{ needs.build.outputs.branch }} Admin UI module to [${{ needs.build.outputs.tag }}](https://github.com/${{ github.repository_owner }}/opencast-admin-interface/releases/tag/${{ needs.build.outputs.tag }})" \
121- --head=${{ github.repository_owner }}:t/admin-ui-${{ needs.build.outputs.tag }} \
122- --base ${{ needs.build.outputs.branch }} \
125+ --title "Update ${{ needs.build-release-tarballs .outputs.branch }} Admin UI to ${{ needs.build-release-tarballs .outputs.tag }}" \
126+ --body "Updating Opencast ${{ needs.build-release-tarballs .outputs.branch }} Admin UI module to [${{ needs.build-release-tarballs .outputs.tag }}](https://github.com/${{ github.repository_owner }}/opencast-admin-interface/releases/tag/${{ needs.build-release-tarballs .outputs.tag }})" \
127+ --head=${{ github.repository_owner }}:t/admin-ui-${{ needs.build-release-tarballs .outputs.tag }} \
128+ --base ${{ needs.build-release-tarballs .outputs.branch }} \
123129 -R ${{ github.repository_owner }}/opencast
124130 #FIXME: fine grained PATs can't apply labels
125131 #FIXME: classic PATs don't have the permissions because the PR isn't in an opencastproject (the user) repo
0 commit comments