From 6862476f6c1393c20558e3844dd4f2323a0fb26e Mon Sep 17 00:00:00 2001 From: Greg Logan Date: Fri, 12 Jun 2026 16:21:16 -0600 Subject: [PATCH] Aping the docker image approach, breaking the test branch deployment into two components as well. --- .github/workflows/pr-build-test-branch.yml | 95 +++++++++++++++++++++ .github/workflows/pr-deploy-test-branch.yml | 88 +++---------------- 2 files changed, 106 insertions(+), 77 deletions(-) create mode 100644 .github/workflows/pr-build-test-branch.yml diff --git a/.github/workflows/pr-build-test-branch.yml b/.github/workflows/pr-build-test-branch.yml new file mode 100644 index 0000000000..9934e29777 --- /dev/null +++ b/.github/workflows/pr-build-test-branch.yml @@ -0,0 +1,95 @@ +name: PRs » Build Pull Request Page + +on: + pull_request: + types: + - opened + - synchronize + +concurrency: + group: pull-request-page + 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=https://`./.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 + + build-pr: + runs-on: ubuntu-latest + needs: detect-repo-owner + steps: + - name: Generate build path + run: echo "build=${{github.event.number}}/$(date +%Y-%m-%d_%H-%M-%S)/" >> $GITHUB_OUTPUT + id: build-path + + - 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: | + npm run build + mkdir -p admin-interface-test/${{ steps.build-path.outputs.build }} + mv build/* admin-interface-test/${{ steps.build-path.outputs.build }}/ + tar cf ${{ runner.temp }}/build.tar admin-interface-test + env: + VITE_TEST_SERVER_URL: ${{needs.detect-repo-owner.outputs.server}} + NODE_ENV: development + VITE_TEST_SERVER_AUTH: "admin:opencast" + + - name: Upload build to GHA + uses: actions/upload-artifact@v4 + with: + name: build + path: ${{ runner.temp }}/build.tar + + + check-no-modified-translations: + name: Translations only via Crowdin + if: github.repository_owner == 'opencast' + runs-on: ubuntu-latest + + steps: + - name: Checkout Sources + uses: actions/checkout@v4 + + - name: Get changed locale files + uses: dorny/paths-filter@v3 + id: filter_locales + with: + filters: | # !(pattern) matches anything but pattern + locales: + - 'src/i18n/org/opencastproject/adminui/languages/!lang-(en_US)*.json' + + - name: Check for changes in translations + if: steps.filter_locales.outputs.locales == true + uses: actions/github-script@v7 + with: + script: | + core.setFailed('You should not alter translations outside of Crowdin.') diff --git a/.github/workflows/pr-deploy-test-branch.yml b/.github/workflows/pr-deploy-test-branch.yml index dab4fb609c..6da7d97bde 100644 --- a/.github/workflows/pr-deploy-test-branch.yml +++ b/.github/workflows/pr-deploy-test-branch.yml @@ -1,65 +1,19 @@ name: PRs » Publish Pull Request Page on: - pull_request: + workflow_run: + workflows: ["PRs » Build Pull Request Page"] types: - - opened - - synchronize + - completed concurrency: group: pull-request-page 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=https://`./.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-pr: runs-on: ubuntu-latest - needs: detect-repo-owner steps: - - name: Generate build path - run: echo "build=${{github.event.number}}/$(date +%Y-%m-%d_%H-%M-%S)/" >> $GITHUB_OUTPUT - id: build-path - - - 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: | - npm run build - env: - VITE_TEST_SERVER_URL: ${{needs.detect-repo-owner.outputs.server}} - NODE_ENV: development - VITE_TEST_SERVER_AUTH: "admin:opencast" - - name: Prepare git run: | git config --global user.name "Admin Interface Deployment Bot" @@ -85,12 +39,16 @@ jobs: run: | git clone -b gh-pages "git@github.com:${{ github.repository_owner }}/admin-interface-test.git" admin-interface-test + - name: Fetch build from GHA + uses: actions/download-artifact@v4 + with: + name: build + path: ${{ runner.temp }}/build.tar + run-id: ${{ github.event.workflow_run.id }} + - name: Store build in the clone - env: - DEPLOY_PATH: admin-interface-test/${{ steps.build-path.outputs.build }} run: | - mkdir -p ${DEPLOY_PATH} - cp -rv build/* ${DEPLOY_PATH} + tar xf ${{ runner.temp }}/build.tar - name: Cleanup test repository working-directory: admin-interface-test @@ -132,27 +90,3 @@ jobs: ](https://test.admin-interface.opencast.org/${{ steps.build-path.outputs.build }}). It might take a few minutes for it to become available. - - check-no-modified-translations: - name: Translations only via Crowdin - if: github.repository_owner == 'opencast' - runs-on: ubuntu-latest - - steps: - - name: Checkout Sources - uses: actions/checkout@v4 - - - name: Get changed locale files - uses: dorny/paths-filter@v3 - id: filter_locales - with: - filters: | # !(pattern) matches anything but pattern - locales: - - 'src/i18n/org/opencastproject/adminui/languages/!lang-(en_US)*.json' - - - name: Check for changes in translations - if: steps.filter_locales.outputs.locales == true - uses: actions/github-script@v7 - with: - script: | - core.setFailed('You should not alter translations outside of Crowdin.')