docs-pr.yaml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. name: Prepare documentation PR preview
  2. on:
  3. pull_request:
  4. paths:
  5. - docs/**
  6. - book.toml
  7. - .github/workflows/docs-pr.yaml
  8. jobs:
  9. pages:
  10. name: GitHub Pages
  11. runs-on: ubuntu-latest
  12. steps:
  13. - uses: actions/checkout@v2
  14. - name: Setup mdbook
  15. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  16. with:
  17. mdbook-version: '0.4.17'
  18. - name: Build the documentation
  19. # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
  20. # However, we're using docs/README.md for other purposes and need to pick a new page
  21. # as the default. Let's opt for the welcome page instead.
  22. run: |
  23. mdbook build
  24. cp book/welcome_and_overview.html book/index.html
  25. - name: Upload Artifact
  26. uses: actions/upload-artifact@v3
  27. with:
  28. name: book
  29. path: book
  30. # We'll only use this in a workflow_run, then we're done with it
  31. retention-days: 1
  32. link-check:
  33. name: Check links in documentation
  34. runs-on: ubuntu-latest
  35. steps:
  36. - uses: actions/checkout@v2
  37. - name: Setup mdbook
  38. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  39. with:
  40. mdbook-version: '0.4.17'
  41. - name: Setup htmltest
  42. run: |
  43. wget https://github.com/wjdp/htmltest/releases/download/v0.17.0/htmltest_0.17.0_linux_amd64.tar.gz
  44. echo '775c597ee74899d6002cd2d93076f897f4ba68686bceabe2e5d72e84c57bc0fb htmltest_0.17.0_linux_amd64.tar.gz' | sha256sum -c
  45. tar zxf htmltest_0.17.0_linux_amd64.tar.gz
  46. - name: Test links with htmltest
  47. # Build the book with `./` as the site URL (to make checks on 404.html possible)
  48. # Then run htmltest (without checking external links since that involves the network and is slow).
  49. run: |
  50. MDBOOK_OUTPUT__HTML__SITE_URL="./" mdbook build
  51. ./htmltest book --skip-external