Merge branch 'chapter-scrolling' of Arnei/opencast-editor into r/19.x #25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build » Deploy main branches | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - r/* | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: false | |
| jobs: | |
| detect-repo-owner: | |
| if: github.repository_owner == 'opencast' | |
| runs-on: ubuntu-latest | |
| outputs: | |
| server: ${{ steps.test-server.outputs.server }} | |
| branch: ${{ steps.branch-name.outputs.branch }} | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v5 | |
| - name: Determine the correct test server | |
| id: test-server | |
| run: echo "server=`./.github/get-release-server.sh ${{ github.ref_name }}`" >> $GITHUB_OUTPUT | |
| - name: Determine branch name | |
| id: branch-name | |
| run: | | |
| #Temp becomes something like r/17.x | |
| export TEMP=${{ github.ref_name }} | |
| #Strip the r/ prefix, giving us just 17.x. If this is main/develop this does nothing | |
| echo "branch=${TEMP#r\/}" >> $GITHUB_OUTPUT | |
| deploy-main-branches: | |
| runs-on: ubuntu-latest | |
| needs: detect-repo-owner | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v5 | |
| - name: Get Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 20 | |
| - name: Run npm ci | |
| run: npm ci | |
| - name: Build the app | |
| run: | | |
| # This set the editor's datasource to the relevant test server | |
| sed -i "s#develop.opencast.org#$SERVER#g" public/editor-settings.toml | |
| npm run build | |
| env: | |
| SERVER: ${{needs.detect-repo-owner.outputs.server}} | |
| PUBLIC_URL: ${{needs.detect-repo-owner.outputs.branch}} | |
| VITE_APP_SETTINGS_PATH: editor-settings.toml | |
| # tests are currently failing | |
| #- run: npm test | |
| # env: | |
| # CI: true | |
| - name: Prepare git | |
| run: | | |
| git config --global user.name "Editor Deployment Bot" | |
| git config --global user.email "cloud@opencast.org" | |
| - name: Commit new version | |
| run: | | |
| git checkout -- public/editor-settings.toml | |
| git fetch --unshallow origin gh-pages | |
| git checkout gh-pages | |
| # Update gh-pages | |
| rm -rf $BRANCH | |
| mv build $BRANCH | |
| #Generate an index, in case anyone lands at the root of the test domain | |
| echo $'<html><head><link rel=stylesheet type=text/css href=assets/index.css /></head><body><div class="head-container"><img src=assets/opencast-white.svg /></div><div class="navbar-container"></div><div class="text-container"><p>Deployment for the latest development versions of the Opencast editor.The branches listed here correspond to Opencast\'s own branches.</br><b>Please select a version.</b></p></div><ul>' > index.html | |
| find . -mindepth 1 -maxdepth 1 -type d \ | |
| | grep '[0-9]*.x\|develop' \ | |
| | sort -r \ | |
| | sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html | |
| echo '</ul></body></html>' >> index.html | |
| git add $BRANCH index.html | |
| git diff --staged --quiet || git commit --amend -m "Build $(date)" | |
| env: | |
| BRANCH: ${{needs.detect-repo-owner.outputs.branch}} | |
| - name: update CSS and other assets | |
| if: github.ref == 'refs/heads/develop' | |
| run: | | |
| rm -rf assets | |
| mv assets_temp assets | |
| git add assets | |
| git diff --staged --quiet || git commit --amend -m "Build $(date)" | |
| - name: Push updates | |
| run: git push origin gh-pages --force |