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.
 
 
 
 
 
 

118 lines
3.6 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@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: Set version of docs
  56. run: echo 'window.SYNAPSE_VERSION = "${{ needs.pre.outputs.branch-version }}";' > ./docs/website_files/version.js
  57. - name: Setup python
  58. uses: actions/setup-python@v4
  59. with:
  60. python-version: "3.x"
  61. - run: "pip install 'packaging>=20.0' 'GitPython>=3.1.20'"
  62. - name: Build the documentation
  63. # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
  64. # However, we're using docs/README.md for other purposes and need to pick a new page
  65. # as the default. Let's opt for the welcome page instead.
  66. run: |
  67. mdbook build
  68. cp book/welcome_and_overview.html book/index.html
  69. # Deploy to the target directory.
  70. - name: Deploy to gh pages
  71. uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
  72. with:
  73. github_token: ${{ secrets.GITHUB_TOKEN }}
  74. publish_dir: ./book
  75. destination_dir: ./${{ needs.pre.outputs.branch-version }}
  76. ################################################################################
  77. pages-devdocs:
  78. name: GitHub Pages (developer docs)
  79. runs-on: ubuntu-latest
  80. needs:
  81. - pre
  82. steps:
  83. - uses: actions/checkout@v4
  84. - name: "Set up Sphinx"
  85. uses: matrix-org/setup-python-poetry@v1
  86. with:
  87. python-version: "3.x"
  88. poetry-version: "1.3.2"
  89. groups: "dev-docs"
  90. extras: ""
  91. - name: Build the documentation
  92. run: |
  93. cd dev-docs
  94. poetry run make html
  95. # Deploy to the target directory.
  96. - name: Deploy to gh pages
  97. uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
  98. with:
  99. github_token: ${{ secrets.GITHUB_TOKEN }}
  100. publish_dir: ./dev-docs/_build/html
  101. destination_dir: ./dev-docs/${{ needs.pre.outputs.branch-version }}