deploy-docs.yml 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Workflow that builds and deploys the documentation website
  2. name: Deploy Docs to GitHub Pages
  3. # * Always run on "main"
  4. # * Run on PRs that target the "main" branch and have changes in the "docs" folder or this workflow
  5. on:
  6. push:
  7. branches:
  8. - main
  9. pull_request:
  10. paths:
  11. - 'docs/**'
  12. - '.github/workflows/deploy-docs.yml'
  13. branches:
  14. - main
  15. jobs:
  16. # Build the documentation website
  17. build:
  18. if: github.repository == 'All-Hands-AI/OpenHands'
  19. name: Build Docusaurus
  20. runs-on: ubuntu-latest
  21. steps:
  22. - uses: actions/checkout@v4
  23. with:
  24. fetch-depth: 0
  25. - uses: actions/setup-node@v4
  26. with:
  27. node-version: 18
  28. cache: npm
  29. cache-dependency-path: docs/package-lock.json
  30. - name: Set up Python
  31. uses: actions/setup-python@v5
  32. with:
  33. python-version: '3.11'
  34. - name: Generate Python Docs
  35. run: rm -rf docs/modules/python && pip install pydoc-markdown && pydoc-markdown
  36. - name: Install dependencies
  37. run: cd docs && npm ci
  38. - name: Build website
  39. run: cd docs && npm run build
  40. - name: Upload Build Artifact
  41. if: github.ref == 'refs/heads/main'
  42. uses: actions/upload-pages-artifact@v3
  43. with:
  44. path: docs/build
  45. # Deploy the documentation website
  46. deploy:
  47. if: github.ref == 'refs/heads/main' && github.repository == 'All-Hands-AI/OpenHands'
  48. name: Deploy to GitHub Pages
  49. runs-on: ubuntu-latest
  50. # This job only runs on "main" so only run one of these jobs at a time
  51. # otherwise it will fail if one is already running
  52. concurrency:
  53. group: ${{ github.workflow }}-${{ github.ref }}
  54. needs: build
  55. # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
  56. permissions:
  57. pages: write # to deploy to Pages
  58. id-token: write # to verify the deployment originates from an appropriate source
  59. # Deploy to the github-pages environment
  60. environment:
  61. name: github-pages
  62. url: ${{ steps.deployment.outputs.page_url }}
  63. steps:
  64. - name: Deploy to GitHub Pages
  65. id: deployment
  66. uses: actions/deploy-pages@v4