From 70ca1a854e27754d4e095d4092532fc0a6db0d98 Mon Sep 17 00:00:00 2001 From: Charlie Kindel Date: Sat, 17 Sep 2022 08:59:30 -0600 Subject: [PATCH] Adds new workflow for generating API docs via Github action --- .github/workflows/api-docs.yml | 54 ++++++++++++++++++++++++++++++++++ docfx/README.md | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/api-docs.yml diff --git a/.github/workflows/api-docs.yml b/.github/workflows/api-docs.yml new file mode 100644 index 000000000..a33ddc344 --- /dev/null +++ b/.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/docfx-action@v1.0.0 + # 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 \ No newline at end of file diff --git a/docfx/README.md b/docfx/README.md index ccffd37e0..cd3a725ba 100644 --- a/docfx/README.md +++ b/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`. \ No newline at end of file +Note the `./docfx/build.ps1` script will create a `./docs` folder. This folder is ignored by `.gitignore`.