render #37037
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: Main Rendering | |
| on: | |
| repository_dispatch: | |
| types: [ 'render' ] | |
| jobs: | |
| render: | |
| runs-on: ubuntu-latest | |
| name: Render ${{ github.event.client_payload.vendor }}/${{ github.event.client_payload.name }} | |
| if: ${{ github.event.client_payload.repository_url != '' && github.event.client_payload.source_branch != '' && github.event.client_payload.target_branch_directory != '' }} | |
| steps: | |
| - name: Notify on start | |
| if: ${{ always() }} | |
| uses: distributhor/workflow-webhook@v1 | |
| env: | |
| webhook_url: ${{ secrets.WEBHOOK_START_URL }} | |
| webhook_secret: ${{ secrets.WEBHOOK_SECRET }} | |
| data: '{"success":false,"id":"${{ github.event.client_payload.id }}","link":"https://github.com/TYPO3-Documentation/t3docs-ci-deploy/actions/runs/${{ github.run_id }}"}' | |
| # See https://github.com/TYPO3-Documentation/gh-render-action/blob/main/action.yml | |
| - name: Render Repository | |
| uses: TYPO3-Documentation/gh-render-action@main | |
| id: rendering | |
| with: | |
| repository_url: ${{ github.event.client_payload.repository_url }} | |
| source_branch: ${{ github.event.client_payload.source_branch }} | |
| target_branch_directory: ${{ github.event.client_payload.target_branch_directory }} | |
| - name: Archive render result | |
| run: | | |
| pushd ${{ steps.rendering.outputs.renderedPath }} | |
| zip rendered-docs.zip . -r | |
| popd | |
| mv ${{ steps.rendering.outputs.renderedPath }}/rendered-docs.zip . | |
| - name: Publish archive with result | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: result | |
| path: rendered-docs.zip | |
| if-no-files-found: error | |
| - name: Notify on failure | |
| if: ${{ failure() }} | |
| uses: distributhor/workflow-webhook@v1 | |
| env: | |
| webhook_url: ${{ secrets.WEBHOOK_URL }} | |
| webhook_secret: ${{ secrets.WEBHOOK_SECRET }} | |
| data: '{"success":false,"id":"${{ github.event.client_payload.id }}","link":"https://github.com/TYPO3-Documentation/t3docs-ci-deploy/actions/runs/${{ github.run_id }}"}' | |
| deploy: | |
| runs-on: ubuntu-latest | |
| name: Deploy ${{ github.event.client_payload.vendor }}/${{ github.event.client_payload.name }} | |
| needs: render | |
| if: ${{ github.event.client_payload.type_short != '' && github.event.client_payload.vendor != '' && github.event.client_payload.name != '' && github.event.client_payload.target_branch_directory != ''}} | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: result | |
| - name: Extract render result | |
| run: unzip rendered-docs.zip -d result | |
| - name: Fallback to README-like file if Index.html is missing | |
| run: | | |
| fallback=$(find result -type f -iname "readme.html" | head -n 1) | |
| if [ -n "$fallback" ]; then | |
| fallback_dir=$(dirname "$fallback") | |
| if [ ! -f "$fallback_dir/Index.html" ]; then | |
| cp "$fallback" "$fallback_dir/Index.html" | |
| fi | |
| fi | |
| - name: Insert redirecting Index.html in folders missing one | |
| shell: bash | |
| run: | | |
| find result \( -path "*/_sources" -o -path "*/_sources/*" -o -path "*/_resources" -o -path "*/_resources/*" \) -prune -o -type d -print | while read dir; do | |
| if [ ! -f "$dir/Index.html" ]; then | |
| echo "Creating Index.html in $dir" | |
| echo '<!DOCTYPE html>' > "$dir/Index.html" | |
| echo '<html>' >> "$dir/Index.html" | |
| echo ' <head>' >> "$dir/Index.html" | |
| echo ' <meta http-equiv="refresh" content="0; url=../Index.html">' >> "$dir/Index.html" | |
| echo ' </head>' >> "$dir/Index.html" | |
| echo ' <body>' >> "$dir/Index.html" | |
| echo ' <p>If you are not redirected, <a href="../Index.html">click here</a>.</p>' >> "$dir/Index.html" | |
| echo ' </body>' >> "$dir/Index.html" | |
| echo '</html>' >> "$dir/Index.html" | |
| fi | |
| done | |
| - name: Upload Documentation | |
| uses: appleboy/scp-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_DOCS_HOST }} | |
| username: ${{ secrets.DEPLOY_DOCS_USERNAME }} | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| source: "result/" | |
| rm: true | |
| strip_components: 1 | |
| tar_tmp_path: ${{ secrets.TMP_TARGET_PATH }} | |
| target: ${{ secrets.TARGET_PATH }}/${{ github.event.client_payload.type_short }}/${{ github.event.client_payload.vendor }}/${{ github.event.client_payload.name }}/${{ github.event.client_payload.target_branch_directory }} | |
| - name: Update Extension list | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_DOCS_HOST }} | |
| username: ${{ secrets.DEPLOY_DOCS_USERNAME }} | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| script: curl https://intercept.typo3.com/assets/docs/extensions.js --output ${{ secrets.TARGET_PATH }}/Home/extensions.js | |
| - name: Update search data | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.DEPLOY_DOCS_HOST }} | |
| username: ${{ secrets.DEPLOY_DOCS_USERNAME }} | |
| key: ${{ secrets.DEPLOY_KEY }} | |
| command_timeout: 20m | |
| script: | | |
| export APP_ENV=prod | |
| export APP_SECRET=${{ secrets.DOC_SEARCH_APP_SECRET }} | |
| export DOCS_ROOT_PATH=${{ secrets.TARGET_PATH }} | |
| cd ${{ secrets.DOC_SEARCH_PATH }} | |
| ./bin/console docsearch:import ${{ github.event.client_payload.type_short }}/${{ github.event.client_payload.vendor }}/${{ github.event.client_payload.name }}/${{ github.event.client_payload.target_branch_directory }} | |
| - name: Notify on failure | |
| if: ${{ failure() }} | |
| uses: distributhor/workflow-webhook@v1 | |
| env: | |
| webhook_url: ${{ secrets.WEBHOOK_URL }} | |
| webhook_secret: ${{ secrets.WEBHOOK_SECRET }} | |
| data: '{"success":false,"id":"${{ github.event.client_payload.id }}","link":"https://github.com/TYPO3-Documentation/t3docs-ci-deploy/actions/runs/${{ github.run_id }}"}' | |
| - name: Notify on success | |
| if: ${{ success() }} | |
| uses: distributhor/workflow-webhook@v1 | |
| env: | |
| webhook_url: ${{ secrets.WEBHOOK_URL }} | |
| webhook_secret: ${{ secrets.WEBHOOK_SECRET }} | |
| data: '{"success":true,"id":"${{ github.event.client_payload.id }}","link":"https://github.com/TYPO3-Documentation/t3docs-ci-deploy/actions/runs/${{ github.run_id }}"}' |