PRs » Publish Pull Request Page #330
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: PRs » Publish Pull Request Page | |
| on: | |
| workflow_run: | |
| workflows: ["PRs » Build Pull Request Page"] | |
| types: | |
| - completed | |
| concurrency: | |
| group: pull-request-page | |
| cancel-in-progress: false | |
| jobs: | |
| deploy-pr: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Prepare git | |
| run: | | |
| git config --global user.name "Admin Interface Deployment Bot" | |
| git config --global user.email "cloud@opencast.org" | |
| - name: Prepare GitHub SSH key from org level secret | |
| env: | |
| DEPLOY_KEY: ${{ secrets.DEPLOY_KEY_TEST }} | |
| run: | | |
| install -dm 700 ~/.ssh/ | |
| echo "${DEPLOY_KEY}" > ~/.ssh/id_ed25519 | |
| chmod 600 ~/.ssh/id_ed25519 | |
| ssh-keyscan github.com >> ~/.ssh/known_hosts | |
| - name: Wait for previous workflows to finish | |
| uses: softprops/turnstyle@v3 | |
| with: | |
| same-branch-only: false | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clone repository | |
| 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 | |
| run: | | |
| tar xf ${{ runner.temp }}/build.tar | |
| - name: Cleanup test repository | |
| working-directory: admin-interface-test | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: | | |
| 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 . | |
| - name: Generate index.html | |
| working-directory: admin-interface-test | |
| run: | | |
| echo '<html><body><ul>' > index.html | |
| find . -maxdepth 2 -name '*_*' -type d \ | |
| | sort -r \ | |
| | sed 's/^\(.*\)$/<li><a href=\1>\1<\/a><\/li>/' >> index.html | |
| echo '</ul></body></html>' >> index.html | |
| - name: Commit new version | |
| working-directory: admin-interface-test | |
| run: | | |
| git add . | |
| git commit --amend -m "Build ${{ steps.build-path.outputs.build }}" | |
| - name: Force push admin interface test branch | |
| working-directory: admin-interface-test | |
| run: | | |
| git push origin gh-pages --force | |
| - name: Add comment with deployment location | |
| uses: thollander/actions-comment-pull-request@v3 | |
| with: | |
| comment-tag: static-test-deployment | |
| message: > | |
| This pull request is deployed at | |
| [test.admin-interface.opencast.org/${{ steps.build-path.outputs.build }} | |
| ](https://test.admin-interface.opencast.org/${{ steps.build-path.outputs.build }}). | |
| It might take a few minutes for it to become available. |