Publish Docs #3
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: Publish Docs | |
| on: | |
| push: | |
| branches: [master] | |
| paths: | |
| - 'docs/**' | |
| - 'src/DocSamples/**' | |
| - 'mdsnippets.json' | |
| - 'package.json' | |
| workflow_dispatch: | |
| env: | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| jobs: | |
| publish: | |
| name: Build and deploy docs to Netlify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| - name: Install .NET 9.0.x | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 9.0.x | |
| - name: Install .NET 10.0.x | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Build DocSamples | |
| run: dotnet build src/DocSamples/DocSamples.csproj -c Release | |
| - name: Install mdsnippets | |
| run: dotnet tool install -g markdownSnippets.tool | |
| - name: Run mdsnippets | |
| run: mdsnippets | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Build VitePress site | |
| run: npx vitepress build docs | |
| - name: Deploy to Netlify | |
| uses: nwtgck/actions-netlify@v3 | |
| with: | |
| publish-dir: docs/.vitepress/dist | |
| production-deploy: true | |
| env: | |
| NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
| NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |