|
1 | 1 | name: Build » Deploy main branches |
2 | 2 |
|
| 3 | +# NOTE: This should *not* run on tags, these are handled in the main repo |
3 | 4 | on: |
4 | 5 | push: |
5 | 6 | branches: |
|
33 | 34 | #Strip the r/ prefix, giving us just 17.x. If this is main/develop this does nothing |
34 | 35 | echo "branch=${TEMP#r\/}" >> $GITHUB_OUTPUT |
35 | 36 |
|
| 37 | +
|
36 | 38 | deploy-main-branches: |
37 | 39 | runs-on: ubuntu-latest |
38 | 40 | needs: detect-repo-owner |
|
91 | 93 | git add assets |
92 | 94 | git diff --staged --quiet || git commit --amend -m "Build $(date)" |
93 | 95 |
|
94 | | -
|
95 | 96 | - name: Push updates |
96 | 97 | run: git push origin gh-pages --force |
| 98 | + |
| 99 | + |
| 100 | + file-upstream-admin-pr: |
| 101 | + name: Create upstream admin PR to incorporate build |
| 102 | + runs-on: ubuntu-latest |
| 103 | + needs: detect-repo-owner |
| 104 | + permissions: |
| 105 | + contents: write # For the release |
| 106 | + pull-requests: write # For the PR in the upstream repo |
| 107 | + |
| 108 | + steps: |
| 109 | + - name: Prepare git |
| 110 | + run: | |
| 111 | + git config --global user.name "Admin Interface Commit Bot" |
| 112 | + git config --global user.email "cloud@opencast.org" |
| 113 | +
|
| 114 | + - name: Prepare GitHub SSH key |
| 115 | + env: |
| 116 | + DEPLOY_KEY: ${{ secrets.MODULE_PR_DEPLOY_KEY }} |
| 117 | + run: | |
| 118 | + install -dm 700 ~/.ssh/ |
| 119 | + echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 |
| 120 | + chmod 600 ~/.ssh/id_ed25519 |
| 121 | + ssh-keyscan github.com >> ~/.ssh/known_hosts |
| 122 | +
|
| 123 | + - name: Clone upstream repository |
| 124 | + run: | |
| 125 | + git clone -b ${{ github.ref_name }} "git@github.com:${{ github.repository_owner }}/opencast.git" opencast |
| 126 | + cd opencast |
| 127 | + git checkout -b t/admin-$GITHUB_REF |
| 128 | +
|
| 129 | + - name: Update the admin submodule |
| 130 | + working-directory: opencast |
| 131 | + run: | |
| 132 | + # Note: This could be a race condition in that rapid submodule pushes can trigger multiple PRs in short order |
| 133 | + # and we don't have a guarantee that the update triggered by commit A does not end up finding commit B |
| 134 | + # We are going to ignore this possibility since we almost universally want the *latest* commit, though this |
| 135 | + # could end up causing the commit message, and the actual submodule hash to differ. |
| 136 | + git submodule update --init --remote modules/admin-ui |
| 137 | + git add modules/admin-ui |
| 138 | + git commit -m "Updating admin-service to $GITHUB_REF" |
| 139 | + git push origin t/admin-$GITHUB_REF |
| 140 | + # This token is an account wide token which allows creation of PRs and pushes. |
| 141 | + echo "${{ secrets.MODULE_PR_TOKEN }}" > token.txt |
| 142 | + gh auth login --with-token < token.txt |
| 143 | + gh pr create \ |
| 144 | + --title "Update ${{ needs.detect-repo-owner.outputs.branch }} Admin Interface to $GITHUB_REF" \ |
| 145 | + --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)" \ |
| 146 | + --head=${{ github.repository_owner }}:t/admin-$GITHUB_REF \ |
| 147 | + --base ${{ github.ref_name }} \ |
| 148 | + -R ${{ github.repository_owner }}/opencast |
| 149 | + #FIXME: fine grained PATs can't apply labels |
| 150 | + #FIXME: classic PATs don't have the permissions because the PR isn't in an opencastproject (the user) repo |
| 151 | + #--label admin-ui --label maintenance \ |
0 commit comments