Merge pull request #5079 from GitTools/dependabot/github_actions/dot-… #1332
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: Verify & Publish Docs | |
| on: | |
| workflow_dispatch: | |
| repository_dispatch: | |
| types: [ publish-release ] | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - docs/** | |
| - package*.json | |
| - markdownlint.json | |
| - .remarkrc.yaml | |
| - mkdocs.yml | |
| - .github/workflows/docs.yml | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - docs/** | |
| - package*.json | |
| - markdownlint.json | |
| - .remarkrc.yaml | |
| - mkdocs.yml | |
| - .github/workflows/docs.yml | |
| env: | |
| DOTNET_ROLL_FORWARD: "Major" | |
| DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
| DOTNET_NOLOGO: 1 | |
| jobs: | |
| prepare: | |
| name: Prepare Build | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Cache cake frosting | |
| id: cache-cake | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: run | |
| key: run-${{ runner.os }}-${{ hashFiles('./build/**') }} | |
| - name: Use cached tools | |
| id: cache-tools | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: tools | |
| key: tools-${{ runner.os }}-${{ hashFiles('./build/**') }} | |
| - name: Get npm cache directory | |
| shell: bash | |
| id: cache-node-dir | |
| run: | | |
| cacheDir=$(npm config get cache) | |
| echo "dir=$cacheDir" >> "$GITHUB_OUTPUT" | |
| - name: Cache Node Modules | |
| id: cache-node | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 | |
| with: | |
| path: ${{ steps.cache-node-dir.outputs.dir }} | |
| key: node-${{ runner.os }}-${{ hashFiles('./package-lock.json') }} | |
| restore-keys: node-${{ runner.os }} | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 | |
| with: | |
| global-json-file: global.json | |
| - name: '[Build]' | |
| if: steps.cache-cake.outputs.cache-hit != 'true' | |
| run: dotnet build build/ --configuration=Release | |
| - name: '[Prepare]' | |
| shell: pwsh | |
| run: dotnet run/build.dll --target=BuildPrepare | |
| validate: | |
| name: Validates Html | |
| needs: [ prepare ] | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Restore State | |
| uses: ./.github/actions/cache-restore | |
| - name: '[Build Documentation]' | |
| shell: pwsh | |
| run: dotnet run/docs.dll --target=BuildDocs | |
| - name: '[HTMLProofer]' | |
| uses: chabad360/htmlproofer@c2750eb7eb937599ac859517e7dd23a29f1b3ed7 # v2 | |
| with: | |
| directory: ./artifacts/docs/preview | |
| arguments: --ignore-urls /api/,/docs/,/5.12.0/ --allow-hash-href --allow-missing-href --assume-extension --disable-external --no-check_external_hash | |
| - name: '[Reviewdog Reporter]' | |
| id: reporter | |
| run: | | |
| value=${{ github.event_name == 'pull_request' && 'github-pr-review' || 'github-check' }} | |
| echo "value=$value" >> "$GITHUB_OUTPUT" | |
| - name: '[Remark Lint]' | |
| uses: reviewdog/action-remark-lint@82225f7db5b4a3caaca3052733b6800fa7d109b0 # v5.18.0 | |
| with: | |
| github_token: ${{ github.token }} | |
| reporter: ${{ steps.reporter.outputs.value }} | |
| publish: | |
| if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' | |
| name: Publish docs | |
| needs: [ validate ] | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: write | |
| env: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| GITHUB_USERNAME: ${{ github.actor }} | |
| steps: | |
| - name: Harden the runner (Audit all outbound calls) | |
| uses: step-security/harden-runner@bf7454d06d71f1098171f2acdf0cd4708d7b5920 # v2.20.0 | |
| with: | |
| egress-policy: audit | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| fetch-depth: 0 | |
| - name: Restore State | |
| uses: ./.github/actions/cache-restore | |
| - name: '[Build Schemas]' | |
| shell: pwsh | |
| run: dotnet run/docs.dll --target=GenerateSchemas | |
| - name: '[Publish Documentation]' | |
| if: github.event_name == 'repository_dispatch' || github.event_name == 'workflow_dispatch' | |
| shell: pwsh | |
| run: dotnet run/docs.dll --target=PublishDocs --force |