Sfoglia il codice sorgente

Adds new workflow for generating API docs via Github action

Charlie Kindel 2 anni fa
parent
commit
70ca1a854e
2 ha cambiato i file con 55 aggiunte e 1 eliminazioni
  1. 54 0
      .github/workflows/api-docs.yml
  2. 1 1
      docfx/README.md

+ 54 - 0
.github/workflows/api-docs.yml

@@ -0,0 +1,54 @@
+name: Build and publish API docs
+
+on:
+  push:
+    branches: [main]
+
+jobs:
+  generate-docs:
+    runs-on: windows-latest
+
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v2
+
+    - name: Setup .NET Core
+      uses: actions/setup-dotnet@v1
+      with:
+        dotnet-version: 6.0.100
+    
+    - name: Setup DocFX
+      uses: crazy-max/ghaction-chocolatey@v1
+      with:
+        args: install docfx    
+
+    - name: Install dependencies
+      run: dotnet restore        
+
+    - name: DocFX Build
+      working-directory: docfx
+      # https://stackoverflow.com/questions/56726429/how-to-run-multiple-commands-in-one-github-actions-docker
+      run: |
+        rm ../docs -Recurse -Force
+        docfx docfx.json
+      continue-on-error: false      
+
+    - name: Publish
+      if: github.event_name == 'push'
+      uses: peaceiris/actions-gh-pages@v3
+      with:
+        github_token: ${{ secrets.GITHUB_TOKEN }}
+        publish_dir: docs
+        force_orphan: true
+
+    # - name: Use docfx to build API Docs
+    #   uses: nikeee/[email protected]
+    #   with:
+    #     args: docfx/docfx.json
+
+    # # Publish generated site using GitHub Pages
+    # - uses: maxheld83/ghpages@master
+    #   name: Publish API Documentation on GitHub Pages
+    #   env:
+    #     BUILD_DIR: docs # docfx's default output directory is _site
+    #     GH_PAT: ${{ secrets.GH_PAT }} # See https://github.com/maxheld83/ghpages

+ 1 - 1
docfx/README.md

@@ -11,4 +11,4 @@ The API documentation is generated via a GitHub Action (`.github/workflows/api-d
 
 If `docfx` fails with a `Stackoverflow` error. Just run it again. And again. Sometimes it takes a few times. If that doesn't work, create a fresh clone or delete the `docfx/api`, `docfx/obj`, and `docs/` folders and run the steps above again.
 
-Note the `./docfx/build.ps1` script will create a `./docs` folder. This folder is ignored by `.gitignore`.
+Note the `./docfx/build.ps1` script will create a `./docs` folder. This folder is ignored by `.gitignore`.