|
| 1 | +--- |
| 2 | +name: Publish Documentation |
| 3 | + |
| 4 | +on: |
| 5 | + workflow_call: |
| 6 | + inputs: |
| 7 | + # This is the name of the regular artifact that should |
| 8 | + # be transformed into a GitHub Pages deployment. |
| 9 | + artifact-name: |
| 10 | + type: string |
| 11 | + required: false |
| 12 | + default: html-docs |
| 13 | + |
| 14 | + |
| 15 | +permissions: |
| 16 | + actions: read # For downloading artifacts of other runs when called via workflow_run trigger |
| 17 | + pages: write |
| 18 | + id-token: write |
| 19 | + |
| 20 | +jobs: |
| 21 | + |
| 22 | + # The released docs are not versioned currently, only the latest ones are deployed. |
| 23 | + # |
| 24 | + # Versioning support would require either (better): |
| 25 | + # * Rebuilding docs for all versions when a new release is made |
| 26 | + # * Version selector support in `furo`: https://github.com/pradyunsg/furo/pull/500 |
| 27 | + # |
| 28 | + # or (more basic): |
| 29 | + # * using the `gh-pages` branch and peaceiris/actions-gh-pages |
| 30 | + # to be able to deploy to subdirectories. The implementation via |
| 31 | + # actions/deploy-pages always replaces the directory root. |
| 32 | + |
| 33 | + Deploy-Docs-GH-Pages: |
| 34 | + name: Publish Docs to GitHub Pages |
| 35 | + |
| 36 | + environment: |
| 37 | + name: github-pages |
| 38 | + url: ${{ steps.deployment.outputs.page_url }} |
| 39 | + |
| 40 | + runs-on: ubuntu-24.04 |
| 41 | + |
| 42 | + steps: |
| 43 | + |
| 44 | + - name: Download built docs |
| 45 | + uses: actions/download-artifact@70fc10c6e5e1ce46ad2ea6f2b72d43f7d47b13c3 # v8.0.0 |
| 46 | + with: |
| 47 | + name: ${{ inputs.artifact-name }} |
| 48 | + path: html-docs |
| 49 | + github-token: ${{ github.token }} |
| 50 | + run-id: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.id || github.run_id }} |
| 51 | + |
| 52 | + - name: Upload GitHub Pages artifact |
| 53 | + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 |
| 54 | + with: |
| 55 | + name: html-docs-pages |
| 56 | + path: html-docs |
| 57 | + |
| 58 | + - name: Deploy to GitHub Pages |
| 59 | + id: deployment |
| 60 | + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |
| 61 | + with: |
| 62 | + artifact_name: html-docs-pages |
| 63 | + |
| 64 | + - name: Delete GitHub Pages artifact |
| 65 | + if: always() |
| 66 | + uses: geekyeggo/delete-artifact@7ee91e82b4a7f3339cd8b14beace3d826a2aac39 # v5.1.0 |
| 67 | + with: |
| 68 | + name: html-docs-pages |
| 69 | + failOnError: false |
| 70 | + |
| 71 | + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 72 | + |
| 73 | + - name: Upload Exit Status |
| 74 | + if: always() |
| 75 | + uses: ./.github/actions/upload-exitstatus |
0 commit comments