1- name : Publish Test Page
1+ name : Build & Deploy main brances
22
33on :
44 push :
55 branches :
6- - main
6+ - develop
7+ - r/*
78
89concurrency :
9- group : ${{ github.workflow }}-${{ github.ref }}
10- cancel-in-progress : true
10+ group : ${{ github.workflow }}
11+ cancel-in-progress : false
1112
1213jobs :
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
@@ -26,40 +49,37 @@ jobs:
2649 run : npm ci
2750
2851 - name : build project
29- run : npm run build
52+ run : |
53+ npm run build
54+ env :
55+ VITE_TEST_SERVER_URL : ${{needs.detect.outputs.server}}
56+ NODE_ENV : development
57+ VITE_TEST_SERVER_AUTH : " admin:opencast"
3058
31- - name : create pages directory
32- run : mkdir gh-pages
3359
34- - name : include admin interface
35- run : mv build gh-pages/admin-ui
60+ - name : Prepare git
61+ run : |
62+ git config --global user.name "Release Bot"
63+ git config --global user.email "cloud@opencast.org"
3664
37- - name : include mock data
38- working-directory : ./gh-pages
39- run : cp -rv ../test/GET/* .
65+ - name : Commit new version
66+ run : |
67+ git fetch --unshallow origin gh-pages
68+ git checkout gh-pages
69+ # Update gh-pages
70+ rm -rf $BRANCH
71+ mv build $BRANCH
72+ #Generate an index, in case anyone lands at the root of the test domain
73+ echo '<html><body><ul>' > index.html
74+ find . -mindepth 1 -maxdepth 1 -type d \
75+ | grep '[0-9]*.x\|develop' \
76+ | sort -r \
77+ | sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html
78+ echo '</ul></body></html>' >> index.html
79+ git add $BRANCH index.html
80+ git diff --staged --quiet || git commit --amend -m "Build $(date)"
81+ env :
82+ BRANCH : ${{needs.detect.outputs.branch}}
4083
41- - name : include landing page
42- run : cp .github/demo-page.html gh-pages/index.html
43-
44- - name : upload test page artifact
45- uses : actions/upload-pages-artifact@v3
46- with :
47- path : ./gh-pages
48-
49- deploy :
50- if : github.repository_owner == 'opencast'
51- needs : build
52-
53- permissions :
54- pages : write
55- id-token : write
56-
57- environment :
58- name : github-pages
59- url : ${{ steps.deployment.outputs.page_url }}
60-
61- runs-on : ubuntu-latest
62- steps :
63- - name : deploy to GitHub Pages
64- id : deployment
65- uses : actions/deploy-pages@v4
84+ - name : Push updates
85+ run : git push origin gh-pages --force
0 commit comments