docs.yaml 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. pages:
  14. name: GitHub Pages
  15. runs-on: ubuntu-latest
  16. steps:
  17. - uses: actions/checkout@v2
  18. - name: Setup mdbook
  19. uses: peaceiris/actions-mdbook@4b5ef36b314c2599664ca107bb8c02412548d79d # v1.1.14
  20. with:
  21. mdbook-version: '0.4.9'
  22. - name: Build the documentation
  23. # mdbook will only create an index.html if we're including docs/README.md in SUMMARY.md.
  24. # However, we're using docs/README.md for other purposes and need to pick a new page
  25. # as the default. Let's opt for the welcome page instead.
  26. run: |
  27. mdbook build
  28. cp book/welcome_and_overview.html book/index.html
  29. # Figure out the target directory.
  30. #
  31. # The target directory depends on the name of the branch
  32. #
  33. - name: Get the target directory name
  34. id: vars
  35. run: |
  36. # first strip the 'refs/heads/' prefix with some shell foo
  37. branch="${GITHUB_REF#refs/heads/}"
  38. case $branch in
  39. release-*)
  40. # strip 'release-' from the name for release branches.
  41. branch="${branch#release-}"
  42. ;;
  43. master)
  44. # deploy to "latest" for the master branch.
  45. branch="latest"
  46. ;;
  47. esac
  48. # finally, set the 'branch-version' var.
  49. echo "::set-output name=branch-version::$branch"
  50. # Deploy to the target directory.
  51. - name: Deploy to gh pages
  52. uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # v3.8.0
  53. with:
  54. github_token: ${{ secrets.GITHUB_TOKEN }}
  55. publish_dir: ./book
  56. destination_dir: ./${{ steps.vars.outputs.branch-version }}