diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 43377a8..08f159d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,102 +1,102 @@ -name: Publish docs - -on: - push: - branches: [main] - pull_request: - branches: [main] - workflow_dispatch: - -permissions: - actions: read - pages: write - id-token: write - pull-requests: write - -concurrency: - group: pages - cancel-in-progress: false - -jobs: - validate-docs: - if: github.event_name == 'pull_request' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: | - 8.0.x - 10.0.x - - - name: Restore - run: dotnet restore JD.SemanticKernel.Extensions.slnx - - - name: Install docfx - run: dotnet tool update -g docfx - - - name: Build documentation - run: docfx docs/docfx.json - - - name: Validate output - run: | - if [ ! -d "docs/_site" ]; then - echo "::error::Documentation build did not create _site directory" - exit 1 - fi - HTML_COUNT=$(find docs/_site -name "*.html" | wc -l) - echo "Generated $HTML_COUNT HTML files" - if [ "$HTML_COUNT" -lt 1 ]; then - echo "::error::No HTML files were generated" - exit 1 - fi - echo "::notice::Documentation validation passed! Generated $HTML_COUNT pages." - - - name: Upload preview - uses: actions/upload-artifact@v7 - with: - name: documentation-preview - path: docs/_site - retention-days: 7 - - publish-docs: - if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v6 - with: - fetch-depth: 0 - - - name: Setup .NET - uses: actions/setup-dotnet@v5 - with: - dotnet-version: | - 8.0.x - 10.0.x - - - name: Restore - run: dotnet restore JD.SemanticKernel.Extensions.slnx - - - name: Install docfx - run: dotnet tool update -g docfx - - - name: Build documentation - run: docfx docs/docfx.json - - - name: Upload artifact - uses: actions/upload-pages-artifact@v4 - with: - path: docs/_site - - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 +name: Publish docs + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +permissions: + actions: read + pages: write + id-token: write + pull-requests: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + validate-docs: + if: github.event_name == 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 10.0.x + + - name: Restore + run: dotnet restore JD.SemanticKernel.Extensions.slnx + + - name: Install docfx + run: dotnet tool update -g docfx + + - name: Build documentation + run: docfx docs/docfx.json + + - name: Validate output + run: | + if [ ! -d "docs/_site" ]; then + echo "::error::Documentation build did not create _site directory" + exit 1 + fi + HTML_COUNT=$(find docs/_site -name "*.html" | wc -l) + echo "Generated $HTML_COUNT HTML files" + if [ "$HTML_COUNT" -lt 1 ]; then + echo "::error::No HTML files were generated" + exit 1 + fi + echo "::notice::Documentation validation passed! Generated $HTML_COUNT pages." + + - name: Upload preview + uses: actions/upload-artifact@v7 + with: + name: documentation-preview + path: docs/_site + retention-days: 7 + + publish-docs: + if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v5 + with: + dotnet-version: | + 8.0.x + 10.0.x + + - name: Restore + run: dotnet restore JD.SemanticKernel.Extensions.slnx + + - name: Install docfx + run: dotnet tool update -g docfx + + - name: Build documentation + run: docfx docs/docfx.json + + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: docs/_site + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v5