api-docs.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. name: Build and publish API docs
  2. on:
  3. push:
  4. branches: [main, develop, v2_develop]
  5. jobs:
  6. # generate-docs:
  7. # runs-on: windows-latest
  8. # steps:
  9. # - name: Checkout
  10. # uses: actions/checkout@v3
  11. # - name: Setup .NET Core
  12. # uses: actions/[email protected]
  13. # with:
  14. # dotnet-version: 7.0
  15. # dotnet-quality: 'ga'
  16. # - name: Setup DocFX
  17. # uses: crazy-max/ghaction-chocolatey@v2
  18. # with:
  19. # args: install docfx
  20. # - name: Install dependencies
  21. # run: dotnet restore
  22. # - name: DocFX Build
  23. # working-directory: docfx
  24. # # https://stackoverflow.com/questions/56726429/how-to-run-multiple-commands-in-one-github-actions-docker
  25. # run: |
  26. # rm ../docs -Recurse -Force -ErrorAction SilentlyContinue
  27. # rm ../api -Recurse -Force -ErrorAction SilentlyContinue
  28. # $env:DOCFX_SOURCE_BRANCH_NAME="${{ github.ref_name }}"
  29. # docfx docfx.json
  30. # continue-on-error: false
  31. # - name: Publish
  32. # if: github.event_name == 'push'
  33. # uses: peaceiris/actions-gh-pages@v3
  34. # with:
  35. # github_token: ${{ secrets.GITHUB_TOKEN }}
  36. # publish_dir: docs
  37. # force_orphan: true
  38. # Single deploy job since we're just deploying
  39. deploy:
  40. name: Build and Deploy API docs to gh-pages
  41. environment:
  42. name: github-pages
  43. url: ${{ steps.deployment.outputs.page_url }}
  44. runs-on: windows-latest
  45. steps:
  46. - name: Checkout
  47. uses: actions/checkout@v3
  48. - name: Setup .NET Core
  49. uses: actions/[email protected]
  50. with:
  51. dotnet-version: 7.0
  52. dotnet-quality: 'ga'
  53. - name: Setup DocFX
  54. uses: crazy-max/ghaction-chocolatey@v2
  55. with:
  56. args: install docfx
  57. - name: Install dependencies
  58. run: dotnet restore
  59. - name: DocFX Build
  60. working-directory: docfx
  61. # https://stackoverflow.com/questions/56726429/how-to-run-multiple-commands-in-one-github-actions-docker
  62. run: |
  63. rm ../docs -Recurse -Force -ErrorAction SilentlyContinue
  64. rm ../api -Recurse -Force -ErrorAction SilentlyContinue
  65. $env:DOCFX_SOURCE_BRANCH_NAME="${{ github.ref_name }}"
  66. docfx docfx.json
  67. continue-on-error: false
  68. - name: Setup Pages
  69. uses: actions/configure-pages@v3
  70. - name: Upload artifact
  71. uses: actions/upload-pages-artifact@v2
  72. with:
  73. artifact-name: docs
  74. path: docs
  75. - name: Deploy to GitHub Pages
  76. id: deployment
  77. uses: actions/deploy-pages@v2
  78. with:
  79. github_token: ${{ secrets.GITHUB_TOKEN }}
  80. # - name: Use docfx to build API Docs
  81. # uses: nikeee/[email protected]
  82. # with:
  83. # args: docfx/docfx.json
  84. # # Publish generated site using GitHub Pages
  85. # - uses: maxheld83/ghpages@master
  86. # name: Publish API Documentation on GitHub Pages
  87. # env:
  88. # BUILD_DIR: docs # docfx's default output directory is _site
  89. # GH_PAT: ${{ secrets.GH_PAT }} # See https://github.com/maxheld83/ghpages