docs.yaml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. name: Deploy the documentation
  2. on:
  3. push:
  4. branches:
  5. # For bleeding-edge documentation
  6. - develop
  7. # For documentation specific to a release
  8. - 'release-v*'
  9. # stable docs
  10. - master
  11. workflow_dispatch:
  12. jobs:
  13. pre:
  14. name: Calculate variables for GitHub Pages deployment
  15. runs-on: ubuntu-latest
  16. steps:
  17. # Figure out the target directory.
  18. #
  19. # The target directory depends on the name of the branch
  20. #
  21. - name: Get the target directory name
  22. id: vars
  23. run: |
  24. # first strip the 'refs/heads/' prefix with some shell foo
  25. branch="${GITHUB_REF#refs/heads/}"
  26. case $branch in
  27. release-*)
  28. # strip 'release-' from the name for release branches.
  29. branch="${branch#release-}"
  30. ;;
  31. master)
  32. # deploy to "latest" for the master branch.
  33. branch="latest"
  34. ;;
  35. esac
  36. # finally, set the 'branch-version' var.
  37. echo "branch-version=$branch" >> "$GITHUB_OUTPUT"
  38. outputs:
  39. branch-version: ${{ steps.vars.outputs.branch-version }}
  40. ################################################################################
  41. pages-docs:
  42. name: GitHub Pages
  43. runs-on: ubuntu-latest
  44. needs:
  45. - pre
  46. steps:
  47. - uses: actions/checkout@v4
  48. with:
  49. # Fetch all history so that the schema_versions script works.
  50. fetch-depth: 0
  51. - name: Setup mdbook
  52. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  53. with:
  54. mdbook-version: '0.4.17'
  55. - name: Setup python
  56. uses: actions/setup-python@v4
  57. with:
  58. python-version: "3.x"
  59. - run: "pip install 'packaging>=20.0' 'GitPython>=3.1.20'"
  60. - name: Build the documentation
  61. # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
  62. # However, we're using docs/README.md for other purposes and need to pick a new page
  63. # as the default. Let's opt for the welcome page instead.
  64. run: |
  65. mdbook build
  66. cp book/welcome_and_overview.html book/index.html
  67. # Deploy to the target directory.
  68. - name: Deploy to gh pages
  69. uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
  70. with:
  71. github_token: ${{ secrets.GITHUB_TOKEN }}
  72. publish_dir: ./book
  73. destination_dir: ./${{ needs.pre.outputs.branch-version }}
  74. ################################################################################
  75. pages-devdocs:
  76. name: GitHub Pages (developer docs)
  77. runs-on: ubuntu-latest
  78. needs:
  79. - pre
  80. steps:
  81. - uses: actions/checkout@v4
  82. - name: "Set up Sphinx"
  83. uses: matrix-org/setup-python-poetry@v1
  84. with:
  85. python-version: "3.x"
  86. poetry-version: "1.3.2"
  87. groups: "dev-docs"
  88. extras: ""
  89. - name: Build the documentation
  90. run: |
  91. cd dev-docs
  92. poetry run make html
  93. # Deploy to the target directory.
  94. - name: Deploy to gh pages
  95. uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
  96. with:
  97. github_token: ${{ secrets.GITHUB_TOKEN }}
  98. publish_dir: ./dev-docs/_build/html
  99. destination_dir: ./dev-docs/${{ needs.pre.outputs.branch-version }}