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.

54 lines
1.8 KiB

  1. name: Routine Docs
  2. on:
  3. push:
  4. branches-ignore:
  5. - gh-pages
  6. jobs:
  7. docs:
  8. name: Generate docs
  9. runs-on: windows-latest
  10. steps:
  11. - name: Configure git
  12. run: git config --global core.autocrlf true
  13. - name: Checkout branch
  14. uses: actions/checkout@v2
  15. - name: Checkout submodules
  16. run: git submodule update --init --recursive
  17. - name: Locate MSBuild
  18. uses: warrenbuckley/Setup-MSBuild@v1
  19. - name: Setup Nuget
  20. uses: warrenbuckley/Setup-Nuget@v1
  21. - name: Nuget Restore
  22. run: nuget restore
  23. - name: Install DocFX
  24. uses: crazy-max/ghaction-chocolatey@v1
  25. with:
  26. args: install docfx -y
  27. - name: Build docs
  28. env:
  29. SOURCE_COMMIT: ${{ github.sha }}
  30. shell: powershell
  31. working-directory: ./docs
  32. run: |
  33. Add-Content link_branch.json "{`"_gitContribute`":{`"sourceBranch`":`"$env:SOURCE_COMMIT`",`"apiSpecFolder`":`"docs/override`"}}"
  34. powershell .\build.ps1
  35. if ($lastexitcode -ne 0){
  36. throw [System.Exception] "docfx build failed with exit code $lastexitcode."
  37. }
  38. - name: Publish master site to GitHub pages
  39. uses: seanmiddleditch/gha-publish-to-git@master
  40. with:
  41. branch: gh-pages
  42. github-token: ${{ secrets.pagesCommitToken }}
  43. source_folder: docs/_site
  44. if: github.ref == 'master'
  45. - name: Publish branch site to GitHub pages
  46. uses: seanmiddleditch/gha-publish-to-git@master
  47. with:
  48. branch: gh-pages
  49. github-token: ${{ secrets.pagesCommitToken }}
  50. source_folder: docs/_site
  51. target_folder: branch/${{ github.ref }}
  52. if: github.ref != 'master'