Update docs.yml #57
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Publish Docfx Pages | |
| on: | |
| push: | |
| branches: ["master"] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| publish-docs: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup .NET 10 SDK | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: '10.x' | |
| - name: Restore NuGet packages | |
| run: dotnet restore HelpSense.sln | |
| - name: Install DocFX | |
| run: dotnet tool install -g docfx | |
| # 将 .NET 工具目录加入 PATH,以便直接调用 docfx 命令 | |
| - name: Add dotnet tools to PATH | |
| run: echo "$env:USERPROFILE\.dotnet\tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
| - name: Build Documentation | |
| run: docfx docs/docfx.json | |
| env: | |
| DOCFX_ENABLE_RESTAPI_VALIDATION: false | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: 'docs/_site' | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |