|
| 1 | +name: Build document and deploy to GitHub Page |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: ["main"] |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 9 | +permissions: |
| 10 | + contents: read |
| 11 | + pages: write |
| 12 | + id-token: write |
| 13 | + |
| 14 | +concurrency: |
| 15 | + group: "pages" |
| 16 | + cancel-in-progress: false |
| 17 | + |
| 18 | +defaults: |
| 19 | + run: |
| 20 | + shell: pwsh |
| 21 | + |
| 22 | +jobs: |
| 23 | + build: |
| 24 | + runs-on: windows-latest |
| 25 | + defaults: |
| 26 | + run: |
| 27 | + working-directory: ./docs |
| 28 | + steps: |
| 29 | + # Checkout |
| 30 | + - name: Checkout |
| 31 | + uses: actions/checkout@v4 |
| 32 | + # Install docfx as .NET global tools |
| 33 | + - name: Install docfx |
| 34 | + run: | |
| 35 | + dotnet tool install docfx -g |
| 36 | + # Run `docfx metadata` command |
| 37 | + - name: Generate metadata |
| 38 | + run: | |
| 39 | + docfx metadata |
| 40 | + # Run `docfx build` command |
| 41 | + - name: Build document |
| 42 | + run: | |
| 43 | + docfx build |
| 44 | + # Upload docfx output site |
| 45 | + - name: Upload docfx build results to artifacts |
| 46 | + uses: actions/upload-artifact@v4 |
| 47 | + with: |
| 48 | + name: wwwroot |
| 49 | + path: docs/_site |
| 50 | + if-no-files-found: error |
| 51 | + |
| 52 | + # Single deploy job since we're just deploying |
| 53 | + publish-pages: |
| 54 | + needs: build |
| 55 | + runs-on: ubuntu-latest |
| 56 | + environment: |
| 57 | + name: github-pages |
| 58 | + url: ${{ steps.deployment.outputs.page_url }} |
| 59 | + |
| 60 | + steps: |
| 61 | + # Setup GitHub Pages |
| 62 | + - name: Setup Pages |
| 63 | + uses: actions/configure-pages@v4 |
| 64 | + |
| 65 | + # Download artifacts |
| 66 | + - name: Download artifact |
| 67 | + id: download |
| 68 | + uses: actions/download-artifact@v4 |
| 69 | + with: |
| 70 | + name: wwwroot |
| 71 | + path: temp/wwwroot |
| 72 | + |
| 73 | + # Upload content to GitHub Pages |
| 74 | + - name: Upload artifact |
| 75 | + uses: actions/upload-pages-artifact@v3 |
| 76 | + with: |
| 77 | + path: ${{steps.download.outputs.download-path}} |
| 78 | + |
| 79 | + # Deploy to GitHub Pages |
| 80 | + - name: Deploy to GitHub Pages |
| 81 | + id: deployment |
| 82 | + uses: actions/deploy-pages@v4 |
0 commit comments