deploy-docs.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. # Workflow that builds and deploys the documentation website
  2. name: Deploy Docs to GitHub Pages
  3. # Only run one workflow of the same group at a time.
  4. # There can be at most one running and one pending job in a concurrency group at any time.
  5. concurrency:
  6. group: ${{ github.workflow }}-${{ github.ref }}
  7. cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
  8. # * Always run on "main"
  9. # * Run on PRs that target the "main" branch and have changes in the "docs" folder
  10. on:
  11. push:
  12. branches:
  13. - main
  14. pull_request:
  15. paths:
  16. - 'docs/**'
  17. branches:
  18. - main
  19. jobs:
  20. # Build the documentation website
  21. build:
  22. name: Build Docusaurus
  23. runs-on: ubuntu-latest
  24. if: github.repository == 'OpenDevin/OpenDevin'
  25. steps:
  26. - uses: actions/checkout@v4
  27. with:
  28. fetch-depth: 0
  29. - uses: actions/setup-node@v4
  30. with:
  31. node-version: 18
  32. cache: npm
  33. cache-dependency-path: docs/package-lock.json
  34. - name: Set up Python
  35. uses: actions/setup-python@v5
  36. with:
  37. python-version: '3.11'
  38. - name: Generate Python Docs
  39. run: rm -rf docs/modules/python && pip install pydoc-markdown && pydoc-markdown
  40. - name: Install dependencies
  41. run: cd docs && npm ci
  42. - name: Build website
  43. run: cd docs && npm run build
  44. - name: Upload Build Artifact
  45. if: github.ref == 'refs/heads/main'
  46. uses: actions/upload-pages-artifact@v3
  47. with:
  48. path: docs/build
  49. # Deploy the documentation website
  50. deploy:
  51. name: Deploy to GitHub Pages
  52. runs-on: ubuntu-latest
  53. needs: build
  54. if: github.ref == 'refs/heads/main' && github.repository == 'OpenDevin/OpenDevin'
  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