Skip to content

Commit 8a52313

Browse files
committed
Merge remote-tracking branch 'upstream/r/17.x' into develop
2 parents 5c5a167 + e11a88c commit 8a52313

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+825
-383
lines changed

.github/get-release-server.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,26 @@ cd ~/opencast
1212
#Get the list of *all* branches in the format remotes/origin/r/N.m
1313
#grep for r/N.x
1414
#then use cut to remove remotes/origin
15-
ary=( `git branch -a | grep 'r/[0-9]*.x' | head -n 3 | cut -f 3- -d '/'` )
15+
#then use sort, with a field delimiter of '/', sorting on the *second* key in 'n'umeric 'r'evers order
16+
#then only consider the first 3 entries
17+
ary=( develop `git branch -a | grep origin | grep 'r/[0-9]*.x' | cut -f 3- -d '/' | sort -t '/' -k 2nr | head -n 3` )
1618

1719
#Iterate through the array above.
1820
#If the script input matches the first item, spit out develop
1921
#If the script iput matches hte second item... etc
2022
#If it doesn't match anything, then don't say anything
2123
for i in "${!ary[@]}"
2224
do
23-
if [[ "${ary[$i]}" = "$1" ]]; then
25+
if [[ "${ary[i]}" = "$1" ]]; then
2426
if [[ $i -eq 0 ]]; then
2527
echo "develop.opencast.org"
28+
exit 0
2629
elif [[ $i -eq 1 ]]; then
2730
echo "stable.opencast.org"
31+
exit 0
2832
elif [[ $i -eq 2 ]]; then
2933
echo "legacy.opencast.org"
34+
exit 0
3035
fi
3136
fi
3237
done

.github/workflows/create-release.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,18 @@ jobs:
1919
git config --global user.name 'Release Bot'
2020
2121
- name: tag and push
22+
env:
23+
GH_TOKEN: ${{ github.token }}
2224
run: |
23-
export TEMP=${{ github.ref_name }}
25+
#Translate 'develop' to 18.x or whatever is appropriate
26+
if [ "develop" == "${{ github.ref_name }}" ]; then
27+
#NB normally we only clone just the head ref, but fetch-depth: 0 above gets *all* the history
28+
export TEMP="$((`git branch -a | grep r/ | cut -f 4 -d '/' | cut -f 1 -d '.'` + 1)).x"
29+
else
30+
export TEMP=${{ github.ref_name }}
31+
fi
2432
export TAG=${TEMP#r\/}-`date +%Y-%m-%d`
2533
git tag $TAG
2634
git push origin $TAG
35+
sleep 2
36+
gh workflow run process-release.yml -r $TAG

.github/workflows/crowdin-upload-keys.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: Crowdin » Upload keys
33
on:
44
push:
55
branches:
6-
- main
6+
- develop
7+
- r/*
78

89
concurrency:
910
group: crowdin-${{ github.ref }}

.github/workflows/deploy-main.yml

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,41 @@
1-
name: Publish Test Page
1+
name: Build & Deploy main brances
22

33
on:
44
push:
55
branches:
66
- develop
7-
- r/*.x
7+
- r/*
88

99
concurrency:
1010
group: ${{ github.workflow }}
11+
cancel-in-progress: false
1112

1213
jobs:
13-
build:
14+
detect:
1415
if: github.repository_owner == 'opencast'
1516
runs-on: ubuntu-latest
17+
outputs:
18+
server: ${{ steps.test-server.outputs.server }}
19+
branch: ${{ steps.branch-name.outputs.branch }}
20+
steps:
21+
- name: Checkout sources
22+
uses: actions/checkout@v4
23+
24+
- name: Determine the correct test server
25+
id: test-server
26+
run: echo "server=https://`./.github/get-release-server.sh ${{ github.ref_name }}`" >> $GITHUB_OUTPUT
27+
28+
- name: Determine branch name
29+
id: branch-name
30+
run: |
31+
#Temp becomes something like r/17.x
32+
export TEMP=${{ github.ref_name }}
33+
#Strip the r/ prefix, giving us just 17.x. If this is main/develop this does nothing
34+
echo "branch=${TEMP#r\/}" >> $GITHUB_OUTPUT
35+
36+
main:
37+
runs-on: ubuntu-latest
38+
needs: detect
1639
steps:
1740
- name: checkout code
1841
uses: actions/checkout@v4
@@ -25,16 +48,14 @@ jobs:
2548
- name: download dependencies
2649
run: npm ci
2750

28-
- name: determine the correct test server
29-
id: vite-url
30-
run: echo "VITE_TEST_SERVER_URL=`./.github/get-release-server.sh ${{ github.ref_name }}`" >> GITHUB_ENV
31-
3251
- name: build project
52+
run: |
53+
npm run build
3354
env:
34-
VITE_TEST_SERVER_URL: ${{ steps.vite-url.outputs.VITE_TEST_SERVER_URL }}
55+
VITE_TEST_SERVER_URL: ${{needs.detect.outputs.server}}
3556
NODE_ENV: development
3657
VITE_TEST_SERVER_AUTH: "admin:opencast"
37-
run: npm run build
58+
3859

3960
- name: Prepare git
4061
run: |
@@ -43,26 +64,22 @@ jobs:
4364
4465
- name: Commit new version
4566
run: |
46-
git fetch origin
67+
git fetch --unshallow origin gh-pages
4768
git checkout gh-pages
48-
#Temp becomes something like r/17.x
49-
export TEMP=${{ github.ref_name }}
50-
#Strip the r/ prefix, giving us just 17.x. If this is main/develop this does nothing
51-
export TARGET=${TEMP#r\/}
5269
# Update gh-pages
53-
rm -rf $TARGET
54-
mkdir -p $TARGET
55-
cp -r build/* $TARGET
70+
rm -rf $BRANCH
71+
mv build $BRANCH
5672
#Generate an index, in case anyone lands at the root of the test domain
5773
echo '<html><body><ul>' > index.html
5874
find . -mindepth 1 -maxdepth 1 -type d \
59-
| grep -v .git \
75+
| grep '[0-9]*.x\|develop' \
6076
| sort -r \
6177
| sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html
6278
echo '</ul></body></html>' >> index.html
63-
git add $TARGET
79+
git add $BRANCH index.html
6480
git diff --staged --quiet || git commit --amend -m "Build $(date)"
81+
env:
82+
BRANCH: ${{needs.detect.outputs.branch}}
6583

6684
- name: Push updates
67-
run: |
68-
git push origin gh-pages --force
85+
run: git push origin gh-pages --force

.github/workflows/deploy-test.yml

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,44 @@ concurrency:
1111
cancel-in-progress: false
1212

1313
jobs:
14+
detect:
15+
if: ${{ github.event.pull_request.head.repo.full_name == 'opencast/opencast-admin-interface' }}
16+
runs-on: ubuntu-latest
17+
outputs:
18+
server: ${{ steps.test-server.outputs.server }}
19+
branch: ${{ steps.branch-name.outputs.branch }}
20+
steps:
21+
- name: Checkout sources
22+
uses: actions/checkout@v4
23+
with:
24+
ref: ${{github.event.pull_request.head.ref}}
25+
repository: ${{github.event.pull_request.head.repo.full_name}}
26+
27+
- name: Determine the correct test server
28+
id: test-server
29+
run: echo "server=https://`./.github/get-release-server.sh ${{ github.ref_name }}`" >> $GITHUB_OUTPUT
30+
31+
- name: Determine branch name
32+
id: branch-name
33+
run: |
34+
#Temp becomes something like r/17.x
35+
export TEMP=${{ github.ref_name }}
36+
#Strip the r/ prefix, giving us just 17.x. If this is main/develop this does nothing
37+
echo "branch=${TEMP#r\/}" >> $GITHUB_OUTPUT
38+
1439
main:
1540
runs-on: ubuntu-latest
41+
needs: detect
1642
steps:
1743
- name: generate build path
18-
run: echo "::set-output name=build::${{github.event.number}}/$(date +%Y-%m-%d_%H-%M-%S)/" | sed 's_build::/*_build::_'
44+
run: echo "build=${{github.event.number}}/$(date +%Y-%m-%d_%H-%M-%S)/" >> $GITHUB_OUTPUT
1945
id: build-path
2046

2147
- name: checkout code
2248
uses: actions/checkout@v4
2349
with:
24-
ref: ${{ github.event.pull_request.head.ref }}
25-
repository: ${{ github.event.pull_request.head.repo.full_name }}
50+
ref: ${{github.event.pull_request.head.ref}}
51+
repository: ${{github.event.pull_request.head.repo.full_name}}
2652

2753
- name: get node.js
2854
uses: actions/setup-node@v4
@@ -32,16 +58,13 @@ jobs:
3258
- name: download dependencies
3359
run: npm ci
3460

35-
- name: determine the correct test server
36-
id: vite-url
37-
run: echo "VITE_TEST_SERVER_URL=`./.github/get-release-server.sh ${{ github.base_ref }}`" >> GITHUB_ENV
38-
3961
- name: build app
62+
run: |
63+
npm run build
4064
env:
41-
VITE_TEST_SERVER_URL: ${{ steps.vite-url.outputs.VITE_TEST_SERVER_URL }}
65+
VITE_TEST_SERVER_URL: ${{needs.detect.outputs.server}}
4266
NODE_ENV: development
4367
VITE_TEST_SERVER_AUTH: "admin:opencast"
44-
run: npm run build
4568

4669
- name: prepare git
4770
run: |
@@ -66,20 +89,24 @@ jobs:
6689

6790
- name: clone repository
6891
run: |
69-
git clone "git@github.com:opencast/opencast-admin-interface-test.git" admin-interface-test
92+
git clone -b gh-pages "git@github.com:${{ github.repository_owner }}/opencast-admin-interface-test.git" admin-interface-test
7093
71-
- name: switch to gh-pages branch
72-
working-directory: admin-interface-test
94+
- name: store build
95+
env:
96+
DEPLOY_PATH: admin-interface-test/${{ steps.build-path.outputs.build }}
7397
run: |
74-
git checkout gh-pages
98+
mkdir -p ${DEPLOY_PATH}
99+
cp -rv build/* ${DEPLOY_PATH}
75100
76-
- name: store build
101+
- name: Cleanup test repository
77102
working-directory: admin-interface-test
78103
env:
79-
DEPLOY_PATH: ${{ steps.build-path.outputs.build }}
104+
GH_TOKEN: ${{ github.token }}
80105
run: |
81-
mkdir -p ${DEPLOY_PATH}
82-
cp -rv ../build/* ${DEPLOY_PATH}
106+
wget https://raw.githubusercontent.com/${{ github.repository_owner }}/opencast-admin-interface-test/main/.github/scripts/cleanup-deployments.sh
107+
bash cleanup-deployments.sh ${{ github.repository_owner }}/opencast-admin-interface
108+
rm -f cleanup-deployments.sh
109+
git add .
83110
84111
- name: generate index.html
85112
working-directory: admin-interface-test
@@ -94,12 +121,12 @@ jobs:
94121
working-directory: admin-interface-test
95122
run: |
96123
git add .
97-
git commit -m "Build ${{ steps.build-path.outputs.build }}"
124+
git commit --amend -m "Build ${{ steps.build-path.outputs.build }}"
98125
99126
- name: push updates
100127
working-directory: admin-interface-test
101128
run: |
102-
git push origin gh-pages
129+
git push origin gh-pages --force
103130
104131
- name: add comment with deployment location
105132
uses: thollander/actions-comment-pull-request@v3

.github/workflows/process-release.yml

Lines changed: 58 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ jobs:
1111
name: Create release from tag
1212
if: github.repository_owner == 'opencast'
1313
runs-on: ubuntu-latest
14+
outputs:
15+
checksum: ${{ steps.tarball.outputs.checksum }}
16+
tag: ${{ steps.tarball.outputs.tag }}
17+
branch: ${{ steps.tarball.outputs.branch }}
1418
permissions:
1519
contents: write #for the release
1620
pull-requests: write #For the PR in the upstream repo
@@ -33,12 +37,34 @@ jobs:
3337
run: npm run build
3438

3539
- name: create release tarball
40+
id: tarball
3641
working-directory: build
42+
env:
43+
GH_TOKEN: ${{ github.token }}
3744
run: |
3845
tar -czf "../oc-admin-ui-$(git describe --tags).tar.gz" *
39-
echo INTERFACE_CHECKSUM=`sha256sum oc-admin-ui-$(git describe --tags).tar.gz | cut -f 1 -d " "` >> $GITHUB_ENV
40-
echo INTERFACE_TAG=$(git describe --tags) >> $GITHUB_ENV
41-
echo BASE_BRANCH=$(git describe --tags | cut -c 1-4) >> $GITHUB_ENV
46+
echo checksum=`sha256sum ../oc-admin-ui-$(git describe --tags).tar.gz | cut -f 1 -d " "` >> $GITHUB_OUTPUT
47+
echo tag=$(git describe --tags) >> $GITHUB_OUTPUT
48+
while read branchname
49+
do
50+
#branchname looks like 'develop' or 'r/17.x', the describe + cut looks like '17.x', so we prefix with r/
51+
# NB: branchname == develop *should not match* anything so that we fall back to the if case below
52+
if [ "$branchname" != "r/`git describe --tags | cut -f 1 -d -`" ]; then
53+
continue
54+
fi
55+
echo "Base branch is $branchname"
56+
BASE_BRANCH="$branchname"
57+
echo "branch=$branchname" >> $GITHUB_OUTPUT
58+
break
59+
done <<< `gh api \
60+
-H "Accept: application/vnd.github+json" \
61+
-H "X-GitHub-Api-Version: 2022-11-28" \
62+
/repos/${{ github.repository_owner }}/opencast/branches?per_page=100 | \
63+
jq -r '. | map(select(.name | match("r/[0-9]*.x|develop"))) | .[].name'`
64+
if [ -z "${BASE_BRANCH}" ]; then
65+
echo "Base branch is develop"
66+
echo "branch=develop" >> $GITHUB_OUTPUT
67+
fi
4268
4369
- name: create new release
4470
uses: softprops/action-gh-release@v2
@@ -47,14 +73,24 @@ jobs:
4773
fail_on_unmatched_files: true
4874
generate_release_notes: true
4975

76+
upstream-pr:
77+
name: Create upstream PR to incorporate release
78+
if: github.repository_owner == 'opencast'
79+
runs-on: ubuntu-latest
80+
needs: build
81+
permissions:
82+
contents: write #for the release
83+
pull-requests: write #For the PR in the upstream repo
84+
85+
steps:
5086
- name: Prepare git
5187
run: |
5288
git config --global user.name "Release Bot"
5389
git config --global user.email "cloud@opencast.org"
5490
5591
- name: Prepare GitHub SSH key
5692
env:
57-
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
93+
DEPLOY_KEY: ${{ secrets.MODULE_PR_DEPLOY_KEY }}
5894
run: |
5995
install -dm 700 ~/.ssh/
6096
echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519
@@ -63,24 +99,27 @@ jobs:
6399
64100
- name: Clone upstream repository
65101
run: |
66-
#This token is an account wide token which allows creation of PRs and pushes.
67-
#echo "GH_TOKEN=${{ secrets.ACCESS_TOKEN }}" >> token.txt
68-
#gh auth login --with-token < token.txt
69-
git clone -b r/$BASE_BRANCH "git@github.com:opencast/opencast.git" ~/opencast
70-
cd ~/opencast
71-
git checkout -b t/admin-ui-$INTERFACE_TAG
102+
git clone -b ${{ needs.build.outputs.branch }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast
103+
cd opencast
104+
git checkout -b t/admin-ui-${{ needs.build.outputs.tag }}
72105
73106
- name: Update the admin ui pom file
74-
#env:
75-
# GH_TOKEN: ${{ github.token }}
107+
working-directory: opencast
76108
run: |
77-
cd ~/opencast
78-
sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>$INTERFACE_CHECKSUM</interface.sha256>#" modules/admin-ui-interface/pom.xml
79-
sed -i "s#<interface.url>.*</interface.url>#<interface.url>https://github.com/opencast/opencast-admin-interface/releases/download/$INTERFACE_TAG/oc-admin-ui-$INTERFACE_TAG.tar.gz</interface.url>#" modules/admin-ui-interface/pom.xml
109+
sed -i "s#<interface.sha256>.*</interface.sha256>#<interface.sha256>${{ needs.build.outputs.checksum }}</interface.sha256>#" modules/admin-ui-interface/pom.xml
110+
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
80111
git add modules/admin-ui-interface/pom.xml
81-
git commit -m "Updating admin ui to $INTERFACE_TAG"
82-
git push origin t/admin-ui-$INTERFACE_TAG
112+
git commit -m "Updating admin ui to ${{ needs.build.outputs.tag }}"
113+
git push origin t/admin-ui-${{ needs.build.outputs.tag }}
83114
#This token is an account wide token which allows creation of PRs and pushes.
84-
echo "${{ secrets.PR_TOKEN }}" > token.txt
115+
echo "${{ secrets.MODULE_PR_TOKEN }}" > token.txt
85116
gh auth login --with-token < token.txt
86-
gh pr create --title "Update $BASE_BRANCH Admin UI to $INTERFACE_TAG" --label admin-ui --label maintenance --body "Updating Opencast $BASE_BRANCH Admin UI module to $INTERFACE_TAG" --head=opencast:t/admin-ui-$INTERFACE_TAG --base r/$BASE_BRANCH -R opencast/opencast
117+
gh pr create \
118+
--title "Update ${{ needs.build.outputs.branch }} Admin UI to ${{ needs.build.outputs.tag }}" \
119+
--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 }})" \
120+
--head=${{ github.repository_owner }}:t/admin-ui-${{ needs.build.outputs.tag }} \
121+
--base ${{ needs.build.outputs.branch }} \
122+
-R ${{ github.repository_owner }}/opencast
123+
#FIXME: fine grained PATs can't apply labels
124+
#FIXME: classic PATs don't have the permissions because the PR isn't in an opencastproject (the user) repo
125+
#--label admin-ui --label maintenance \

0 commit comments

Comments
 (0)