diff --git a/.github/workflows/github-pages.yml b/.github/workflows/github-pages.yml index c9d7cad..dd6fc2e 100644 --- a/.github/workflows/github-pages.yml +++ b/.github/workflows/github-pages.yml @@ -1,27 +1,24 @@ -# Your GitHub workflow file under .github/workflows/ -# Trigger the action on push to main +name: CI + Deploy + on: push: branches: - main + pull_request: + branches: + - main + workflow_dispatch: -# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: actions: read pages: write id-token: write -# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. -# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. -concurrency: - group: "pages" - cancel-in-progress: false - jobs: - publish-docs: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + # ----------------------------- + # Build / Test job (run on PR, main push, or manual) + # ----------------------------- + build-docs: runs-on: ubuntu-latest steps: - name: Checkout @@ -30,20 +27,39 @@ jobs: - name: Dotnet Setup uses: actions/setup-dotnet@v3 with: - dotnet-version: 8.x + dotnet-version: 9.x - name: Update submodules env: GITHUB_TOKEN: ${{ secrets.MY_PAT }} run: git submodule update --init --recursive - - - run: dotnet tool update -g docfx - - run: docfx doc/docfx.json + + - name: Install DocFX + run: dotnet tool update -g docfx + + - name: Build Docs + run: docfx doc/docfx.json + + # ----------------------------- + # Deploy job (only run on push to main) + # ----------------------------- + deploy-pages: + needs: build-docs + if: github.ref == 'refs/heads/main' + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + concurrency: + group: "pages" + cancel-in-progress: false + steps: + - name: Checkout + uses: actions/checkout@v3 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - # Upload entire repository path: 'doc/_site' - name: Deploy to GitHub Pages id: deployment