Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions .github/workflows/release-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,28 @@ jobs:
echo tag=$(git describe --tags) >> $GITHUB_OUTPUT
while read branchname
do
#branchname looks like 'develop' or 'r/17.x', the describe + cut looks like '17.x', so we prefix with r/
# NB: branchname == develop *should not match* anything so that we fall back to the if case below
LAST_BRANCH="$branchname"
#branchname looks like 'r/17.x', the describe + cut looks like '17.x', so we prefix with r/
# NB: branchname == develop is not handled here, it's handled below
if [ "$branchname" != "r/`git describe --tags | cut -f 1 -d -`" ]; then
continue
fi
echo "Base branch is $branchname"
BASE_BRANCH="$branchname"
echo "branch=$branchname" >> $GITHUB_OUTPUT
echo "branch=$BASE_BRANCH" >> $GITHUB_OUTPUT
break
done <<< `gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository_owner }}/opencast/branches?per_page=100 | \
jq -r '. | map(select(.name | match("r/[0-9]*.x|develop"))) | .[].name'`
if [ -z "${BASE_BRANCH}" ]; then
echo "Base branch is develop"
jq -r '. | map(select(.name | match("r/[0-9]*.x"))) | .[].name'`
#Figure out what develop branch's version should be
# Bash is, without a doubt, the worst possible way to do this, but here we are...
export DEVELOP_VERSION=$(($(echo $LAST_BRANCH | cut -f 2 -d '/' | cut -f 1 -d '.') + 1)).x
#If we didn't find a match above, *and* the develop branch matches the tag
if [ -z "${BASE_BRANCH}" -a "$DEVELOP_VERSION" == "`git describe --tags | cut -f 1 -d -`" ]; then
echo "Base branch is develop, version $DEVELOP_VERSION"
# Develop is by definition (LAST_BRANCH + 1).x
echo "branch=develop" >> $GITHUB_OUTPUT
fi

Expand Down Expand Up @@ -100,26 +106,26 @@ jobs:

- name: Clone upstream repository
run: |
git clone -b ${{ needs.build.outputs.branch }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast
git clone -b ${{ needs.build-release-tarballs.outputs.branch }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast
cd opencast
git checkout -b t/admin-ui-${{ needs.build.outputs.tag }}
git checkout -b t/admin-ui-${{ needs.build-release-tarballs.outputs.tag }}

- name: Update the admin ui pom file
working-directory: opencast
run: |
sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>${{ needs.build.outputs.checksum }}</interface.sha256>#" modules/admin-ui-interface/pom.xml
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
sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>${{ needs.build-release-tarballs.outputs.checksum }}</interface.sha256>#" modules/admin-ui-interface/pom.xml
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
git add modules/admin-ui-interface/pom.xml
git commit -m "Updating admin ui to ${{ needs.build.outputs.tag }}"
git push origin t/admin-ui-${{ needs.build.outputs.tag }}
git commit -m "Updating admin ui to ${{ needs.build-release-tarballs.outputs.tag }}"
git push origin t/admin-ui-${{ needs.build-release-tarballs.outputs.tag }}
#This token is an account wide token which allows creation of PRs and pushes.
echo "${{ secrets.MODULE_PR_TOKEN }}" > token.txt
gh auth login --with-token < token.txt
gh pr create \
--title "Update ${{ needs.build.outputs.branch }} Admin UI to ${{ needs.build.outputs.tag }}" \
--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 }})" \
--head=${{ github.repository_owner }}:t/admin-ui-${{ needs.build.outputs.tag }} \
--base ${{ needs.build.outputs.branch }} \
--title "Update ${{ needs.build-release-tarballs.outputs.branch }} Admin UI to ${{ needs.build-release-tarballs.outputs.tag }}" \
--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 }})" \
--head=${{ github.repository_owner }}:t/admin-ui-${{ needs.build-release-tarballs.outputs.tag }} \
--base ${{ needs.build-release-tarballs.outputs.branch }} \
-R ${{ github.repository_owner }}/opencast
#FIXME: fine grained PATs can't apply labels
#FIXME: classic PATs don't have the permissions because the PR isn't in an opencastproject (the user) repo
Expand Down