diff --git a/.github/workflows/deploy-main-branches.yml b/.github/workflows/deploy-main-branches.yml index da63e3a0f1..85b0c04b37 100644 --- a/.github/workflows/deploy-main-branches.yml +++ b/.github/workflows/deploy-main-branches.yml @@ -1,5 +1,6 @@ name: Build » Deploy main branches +# NOTE: This should *not* run on tags, these are handled in the main repo on: push: branches: @@ -33,6 +34,7 @@ jobs: #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 @@ -91,6 +93,59 @@ jobs: git add assets git diff --staged --quiet || git commit --amend -m "Build $(date)" - - name: Push updates run: git push origin gh-pages --force + + + file-upstream-admin-pr: + name: Create upstream admin PR to incorporate build + runs-on: ubuntu-latest + needs: detect-repo-owner + permissions: + contents: write # For the release + pull-requests: write # For the PR in the upstream repo + + steps: + - name: Prepare git + run: | + git config --global user.name "Admin Interface Commit Bot" + git config --global user.email "cloud@opencast.org" + + - name: Prepare GitHub SSH key + env: + DEPLOY_KEY: ${{ secrets.MODULE_PR_DEPLOY_KEY }} + run: | + install -dm 700 ~/.ssh/ + echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 + chmod 600 ~/.ssh/id_ed25519 + ssh-keyscan github.com >> ~/.ssh/known_hosts + + - name: Clone upstream repository + run: | + git clone -b ${{ github.ref_name }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast + cd opencast + git checkout -b t/admin-$GITHUB_REF + + - name: Update the admin submodule + working-directory: opencast + run: | + # Note: This could be a race condition in that rapid submodule pushes can trigger multiple PRs in short order + # and we don't have a guarantee that the update triggered by commit A does not end up finding commit B + # We are going to ignore this possibility since we almost universally want the *latest* commit, though this + # could end up causing the commit message, and the actual submodule hash to differ. + git submodule update --init --remote modules/admin-ui + git add modules/admin-ui + git commit -m "Updating admin-service to $GITHUB_REF" + git push origin t/admin-$GITHUB_REF + # 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.detect-repo-owner.outputs.branch }} Admin Interface to $GITHUB_REF" \ + --body "Updating Opencast ${{ needs.detect-repo-owner.outputs.branch }} Admin Interface module to [$GITHUB_REF](https://github.com/${{ github.repository_owner }}/admin-interface/commit/$GITHUB_REF)" \ + --head=${{ github.repository_owner }}:t/admin-$GITHUB_REF \ + --base ${{ github.ref_name }} \ + -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 + #--label admin-ui --label maintenance \ diff --git a/.github/workflows/pr-deploy-test-branch.yml b/.github/workflows/pr-deploy-test-branch.yml index cc3104fa8d..c972c61ac5 100644 --- a/.github/workflows/pr-deploy-test-branch.yml +++ b/.github/workflows/pr-deploy-test-branch.yml @@ -89,7 +89,7 @@ jobs: - name: Clone repository run: | - git clone -b gh-pages "git@github.com:${{ github.repository_owner }}/opencast-admin-interface-test.git" admin-interface-test + git clone -b gh-pages "git@github.com:${{ github.repository_owner }}/-admin-interface-test.git" admin-interface-test - name: Store build in the clone env: @@ -103,8 +103,8 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - wget https://raw.githubusercontent.com/${{ github.repository_owner }}/opencast-admin-interface-test/main/.github/scripts/cleanup-deployments.sh - bash cleanup-deployments.sh ${{ github.repository_owner }}/opencast-admin-interface + wget https://raw.githubusercontent.com/${{ github.repository_owner }}/admin-interface-test/main/.github/scripts/cleanup-deployments.sh + bash cleanup-deployments.sh ${{ github.repository_owner }}/admin-interface rm -f cleanup-deployments.sh git add . diff --git a/.github/workflows/pr-remove-test-branch.yml b/.github/workflows/pr-remove-test-branch.yml index 599c87ca2f..98ea7d6566 100644 --- a/.github/workflows/pr-remove-test-branch.yml +++ b/.github/workflows/pr-remove-test-branch.yml @@ -32,7 +32,7 @@ jobs: - name: Clone test repository run: | - git clone -b gh-pages "git@github.com:opencast/opencast-admin-interface-test.git" admin-interface-test + git clone -b gh-pages "git@github.com:opencast/admin-interface-test.git" admin-interface-test - name: Delete build if present working-directory: admin-interface-test diff --git a/.github/workflows/release-build.yml b/.github/workflows/release-build.yml deleted file mode 100644 index 5352797755..0000000000 --- a/.github/workflows/release-build.yml +++ /dev/null @@ -1,132 +0,0 @@ -name: Release » Process release tag - -on: - workflow_dispatch: - push: - tags: - # CF: 17.x-YYYY-MM-DD - - '*.x-*-*-*' - -jobs: - build-release-tarballs: - name: Create release from tag - if: github.repository_owner == 'opencast' - runs-on: ubuntu-latest - outputs: - checksum: ${{ steps.tarball.outputs.checksum }} - tag: ${{ steps.tarball.outputs.tag }} - branch: ${{ steps.tarball.outputs.branch }} - permissions: - contents: write #for the release - pull-requests: write #For the PR in the upstream repo - - 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 - env: - PUBLIC_URL: /admin-ui - run: npm run build - - - name: Create release tarball - id: tarball - working-directory: build - env: - GH_TOKEN: ${{ github.token }} - run: | - tar -czf "../oc-admin-ui-$(git describe --tags).tar.gz" * - echo checksum=`sha256sum ../oc-admin-ui-$(git describe --tags).tar.gz | cut -f 1 -d " "` >> $GITHUB_OUTPUT - echo tag=$(git describe --tags) >> $GITHUB_OUTPUT - while read branchname - do - 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=$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"))) | .[].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 - - - name: Create new release in github - uses: softprops/action-gh-release@v2 - with: - files: oc-admin-ui-*.tar.gz - fail_on_unmatched_files: true - generate_release_notes: true - - file-upstream-release-pr: - name: Create upstream PR to incorporate release - if: github.repository_owner == 'opencast' - runs-on: ubuntu-latest - needs: build-release-tarballs - permissions: - contents: write #for the release - pull-requests: write #For the PR in the upstream repo - - steps: - - name: Prepare git - run: | - git config --global user.name "Release Bot" - git config --global user.email "cloud@opencast.org" - - - name: Prepare GitHub SSH key - env: - DEPLOY_KEY: ${{ secrets.MODULE_PR_DEPLOY_KEY }} - run: | - install -dm 700 ~/.ssh/ - echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 - chmod 600 ~/.ssh/id_ed25519 - ssh-keyscan github.com >> ~/.ssh/known_hosts - - - name: Clone upstream repository - run: | - 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-release-tarballs.outputs.tag }} - - - name: Update the admin ui pom file - working-directory: opencast - run: | - sed -i "s#.*#${{ needs.build-release-tarballs.outputs.checksum }}#" modules/admin-ui-interface/pom.xml - sed -i "s#.*#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#" modules/admin-ui-interface/pom.xml - git add modules/admin-ui-interface/pom.xml - 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-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 - #--label admin-ui --label maintenance \ diff --git a/.github/workflows/release-cut-tag.yml b/.github/workflows/release-cut-tag.yml deleted file mode 100644 index db80c21818..0000000000 --- a/.github/workflows/release-cut-tag.yml +++ /dev/null @@ -1,36 +0,0 @@ -name: Release » Create release tag - -on: - workflow_dispatch: - -jobs: - create-release-tag: - name: Create release tag - runs-on: ubuntu-latest - steps: - - name: Checkout sources - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Prepare git - run: | - git config --global user.email 'cloud@opencast.org' - git config --global user.name 'Release Bot' - - - name: Tag and push - env: - GH_TOKEN: ${{ github.token }} - run: | - #Translate 'develop' to 18.x or whatever is appropriate - if [ "develop" = "${{ github.ref_name }}" ]; then - #NB normally we only clone just the head ref, but fetch-depth: 0 above gets *all* the history - export TEMP="$((`git branch -a | grep r/ | cut -f 4 -d '/' | sort | tail -n 1 | cut -f 1 -d '.'` + 1)).x" - else - export TEMP=${{ github.ref_name }} - fi - export TAG=${TEMP#r\/}-`date +%Y-%m-%d` - git tag $TAG - git push origin $TAG - sleep 2 - gh workflow run release-build.yml -r $TAG diff --git a/.gitignore b/.gitignore index f9cc73b2f7..ad3737df3c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /node_modules /build .idea/ +/target diff --git a/README.md b/README.md index ab1a6a2904..560a57bba7 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,8 @@ Development and testing To get a local copy of the admin UI to test or develop on, you can do the following: ```sh -git clone git@github.com:opencast/opencast-admin-interface.git opencast-admin-interface-demo -cd opencast-admin-interface-demo +git clone git@github.com:opencast/admin-interface.git admin-interface-demo +cd admin-interface-demo git switch my-branch # or otherwise check out, pull, merge, etc. whatever branch you want to test/hack on npm ci ``` @@ -57,58 +57,17 @@ NODE_ENV=development VITE_TEST_SERVER_URL="https://develop.opencast.org" VITE_TE ``` -How to cut a release for Opencast via the Github UI ---------------------------------------------------- +Admin releases +-------------- -1. (Optional) Run the GitHub Actions workflow [Crowdin » Download translations - ](https://github.com/opencast/opencast-admin-interface/actions/workflows/crowdin-download-translations.yml) - to ensure all changes from Crowdin are included in the new release. - -2. Use the [Release » Create release tag](https://github.com/opencast/opencast-admin-interface/actions/workflows/release-cut-tag.yml) - workflow to create a correctly named tag in the appropriate branch. When running the workflow via the dropdown - ensure you select the correct branch for the release! - -3. Wait for the [Release » Process release tag](https://github.com/opencast/opencast-admin-interface/actions/workflows/release-build.yml) - workflow to finish - - It will create a new [GitHub release](https://github.com/opencast/opencast-admin-interface/releases) - - Review the release and make sure the notes are right, update them if not. - - By selecting the previous release, Github can generate release notes automatically - - This review isn't required to happen prior to the next step! - -5. Merge the upstream issue that the workflow above filed in [Opencast's main repository](https://github.com/opencast/opencast) - - -How to cut a release for Opencast manually with git ---------------------------------------------------- - -1. (Optional) Run the GitHub Actions workflow [Crowdin » Download translations - ](https://github.com/opencast/opencast-admin-interface/actions/workflows/crowdin-download-translations.yml) - to ensure all changes from Crowdin are included in the new release. - -2. Switch to the commit you want to turn into the release - make sure this is the on `develop` or an `r/N.x` branch - -3. Create and push a new tag - ```bash - BRANCH=N.x (make sure the version you write here matches the branch you have checked out) - DATE=$(date +%Y-%m-%d) - git tag -sm "Release $BRANCH-$DATE" -s "$BRANCH-$DATE" - git push upstream "$BRANCH-$DATE":"$BRANCH-$DATE" - ``` - -4. Wait for the [Release » Process release tag](https://github.com/opencast/opencast-admin-interface/actions/workflows/release-build.yml) - workflow to finish - - It will create a new [GitHub release](https://github.com/opencast/opencast-admin-interface/releases) - - Review the release and make sure the notes are right, update them if not. - - By selecting the previous release, Github can generate release notes automatically - - This review isn't required to happen prior to the next step! - -5. Merge the upstream issue that the workflow above filed in [Opencast's main repository](https://github.com/opencast/opencast) +The admin module no longer cuts releases itself. Opencast's release manager will create tags as appropriate and push +as part of the release process. Translating the Admin Interface ------------------------------- -You can help translate the Opencast Admin UI to your language on [crowdin.com/project/opencast-admin-interface](https://crowdin.com/project/opencast-admin-interface). Simply request to join the project on Crowdin and start translating. If you are interested in translating a language that is not a target language right now, please create [a GitHub issue](https://github.com/opencast/opencast-admin-interface/issues) and we will add the language. +You can help translate the Opencast Admin UI to your language on [crowdin.com/project/opencast-admin-interface](https://crowdin.com/project/opencast-admin-interface). Simply request to join the project on Crowdin and start translating. If you are interested in translating a language that is not a target language right now, please create [a GitHub issue](https://github.com/opencast/admin-interface/issues) and we will add the language. This project follows the general form of [Opencast's Localization Process](https://docs.opencast.org/develop/developer/#participate/localization/), especially regarding what happens when you need to [change an existing translation key](https://docs.opencast.org/develop/developer/#participate/localization/#i-need-to-update-the-wording-of-the-source-translation-what-happens). Any questions not answered there should be referred to the mailing lists! @@ -119,3 +78,14 @@ Configuration The Admin UI frontend cannot be directly configured. Rather, it adapts to the various configurations in the Opencast backend. Fore more information, take a look at [Opencast's documentation](https://docs.opencast.org). + + +Admin Repo History +------------------ + +As part of https://github.com/orgs/opencast/discussions/7277 we decided to rewrite the entire history of this +repository. This was done because it contained the *entire* history of Opencast into the Opencast 14 era. All +repository history prior to the addition of this commit should be considered rewritten history, however there should +be no function changes. The previous tags have been rewritten, but the releases in this GitHub repository have not. +This means that the hash attached to a given release prior to 2026-03-26 will *not* match, however the source will +aside from the changes we made. diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000000..e03b544531 --- /dev/null +++ b/pom.xml @@ -0,0 +1,162 @@ + + + 4.0.0 + opencast-admin + bundle + Opencast :: admin + + org.opencastproject + base + 19-SNAPSHOT + ../../pom.xml + + + ${project.basedir}/../.. + false + v20.10.0 + + + + + frontend-no-prebuild + + /admin-ui=-build/ + + + + + org.codehaus.mojo + exec-maven-plugin + + + /admin-ui + + + + + npm ci + + exec + + validate + + npm + + ci + + + + + + npm run build + + exec + + generate-resources + + npm + + run + build + + + + + + + + + + + frontend + + true + + + /admin-ui=-build/ + + + + + com.github.eirslett + frontend-maven-plugin + + ${nodejs.version} + target + + /admin-ui + + + + + install node and npm + validate + + install-node-and-npm + + + ${node.version} + + + + validate + npm ci + + npm + + + ci + + + + npm run build + + npm + + generate-resources + + run build + + + + + + maven-clean-plugin + + + + node_modules + false + + + + + + + + + + + + org.apache.maven.plugins + maven-dependency-plugin + + + org.apache.felix + maven-bundle-plugin + true + + + ${project.artifactId} + ${buildNumber} + ${ui.include.resource} + admin-ui.* + /admin-ui + /admin-ui + index.html + + + + + +