You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

105 lines
3.1 KiB

  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 }}