docs.yaml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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@v3
  48. - name: Setup mdbook
  49. uses: peaceiris/actions-mdbook@adeb05db28a0c0004681db83893d56c0388ea9ea # v1.2.0
  50. with:
  51. mdbook-version: '0.4.17'
  52. - name: Build the documentation
  53. # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
  54. # However, we're using docs/README.md for other purposes and need to pick a new page
  55. # as the default. Let's opt for the welcome page instead.
  56. run: |
  57. mdbook build
  58. cp book/welcome_and_overview.html book/index.html
  59. # Deploy to the target directory.
  60. - name: Deploy to gh pages
  61. uses: peaceiris/actions-gh-pages@bd8c6b06eba6b3d25d72b7a1767993c0aeee42e7 # v3.9.2
  62. with:
  63. github_token: ${{ secrets.GITHUB_TOKEN }}
  64. publish_dir: ./book
  65. destination_dir: ./${{ needs.pre.outputs.branch-version }}
  66. ################################################################################
  67. pages-devdocs:
  68. name: GitHub Pages (developer docs)
  69. runs-on: ubuntu-latest
  70. needs:
  71. - pre
  72. steps:
  73. - uses: action/checkout@v3
  74. - name: "Set up Sphinx"
  75. uses: matrix-org/setup-python-poetry@v1
  76. with:
  77. python-version: "3.x"
  78. poetry-version: "1.3.2"
  79. groups: "dev-docs"
  80. extras: ""
  81. - name: Build the documentation
  82. run: |
  83. cd dev-docs
  84. poetry run make html
  85. # Deploy to the target directory.
  86. - name: Deploy to gh pages
  87. uses: peaceiris/actions-gh-pages@bd8c6b06eba6b3d25d72b7a1767993c0aeee42e7 # v3.9.2
  88. with:
  89. github_token: ${{ secrets.GITHUB_TOKEN }}
  90. publish_dir: ./dev-docs/_build/html
  91. destination_dir: ./dev-docs/${{ needs.pre.outputs.branch-version }}