Fix conflicting required+nullable schema when only NonNullableReferen… #2510
Workflow file for this run
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 | |
| on: | |
| push: | |
| branches: [ master ] | |
| tags: [ 'v*' ] | |
| pull_request: | |
| branches: [ master, dotnet-vnext ] | |
| workflow_dispatch: | |
| env: | |
| DOTNET_CLI_TELEMETRY_OPTOUT: true | |
| DOTNET_GENERATE_ASPNET_CERTIFICATE: false | |
| DOTNET_NOLOGO: true | |
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | |
| DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
| NUGET_XMLDOC_MODE: skip | |
| TERM: xterm | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| name: ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| timeout-minutes: 15 | |
| outputs: | |
| dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} | |
| dotnet-validate-version: ${{ steps.get-dotnet-tools-versions.outputs.dotnet-validate-version }} | |
| nuget-package-validation-version: ${{ steps.get-dotnet-tools-versions.outputs.nuget-package-validation-version }} | |
| package-names: ${{ steps.build.outputs.package-names }} | |
| package-version: ${{ steps.build.outputs.package-version }} | |
| permissions: | |
| attestations: write | |
| contents: write | |
| id-token: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - macos-latest | |
| - ubuntu-latest | |
| - windows-latest | |
| steps: | |
| - name: Update agent configuration | |
| shell: pwsh | |
| run: | | |
| if ($IsWindows) { | |
| "DOTNET_INSTALL_DIR=D:\tools\dotnet" >> ${env:GITHUB_ENV} | |
| "DOTNET_ROOT=D:\tools\dotnet" >> ${env:GITHUB_ENV} | |
| "NUGET_PACKAGES=D:\.nuget\packages" >> ${env:GITHUB_ENV} | |
| } else { | |
| $nugetHome = "~/.nuget/packages" | |
| if (-Not (Test-Path $nugetHome)) { | |
| New-Item -Path $nugetHome -Type Directory -Force | Out-Null | |
| } | |
| $nugetHome = Resolve-Path $nugetHome | |
| "NUGET_PACKAGES=$nugetHome" >> ${env:GITHUB_ENV} | |
| } | |
| - name: Checkout code | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| filter: 'tree:0' | |
| persist-credentials: false | |
| show-progress: false | |
| - name: Setup .NET SDKs | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| with: | |
| dotnet-version: | | |
| 8.0.x | |
| 9.0.x | |
| - name: Setup Node | |
| uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 | |
| with: | |
| node-version: '24' | |
| package-manager-cache: false | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| id: setup-dotnet | |
| - name: Install .NET tools | |
| shell: pwsh | |
| run: | | |
| dotnet tool restore | |
| - name: Build, Package and Test | |
| id: build | |
| shell: pwsh | |
| run: | | |
| ./build.ps1 | |
| - name: Upload Coverage Reports | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: coverage-${{ runner.os }} | |
| path: ./artifacts/coverage | |
| if-no-files-found: ignore | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| with: | |
| flags: ${{ runner.os }} | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Upload test results to Codecov | |
| uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0 | |
| if: ${{ !cancelled() }} | |
| with: | |
| flags: ${{ runner.os }} | |
| report_type: test_results | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Generate SBOM | |
| uses: anchore/sbom-action@e22c389904149dbc22b58101806040fa8d37a610 # v0.24.0 | |
| if: runner.os == 'Windows' | |
| with: | |
| artifact-name: Swashbuckle.AspNetCore.spdx.json | |
| output-file: ./artifacts/Swashbuckle.AspNetCore.spdx.json | |
| path: ./artifacts/bin | |
| upload-release-assets: true | |
| - name: Attest artifacts | |
| uses: actions/attest@59d89421af93a897026c735860bf21b6eb4f7b26 # v4.1.0 | |
| if: | | |
| runner.os == 'Windows' && | |
| github.event.repository.fork == false && | |
| (github.ref_name == github.event.repository.default_branch || startsWith(github.ref, 'refs/tags/v')) | |
| with: | |
| subject-path: | | |
| ./artifacts/Swashbuckle.AspNetCore.spdx.json | |
| ./artifacts/bin/Swashbuckle.AspNetCore*/release_*/**/Swashbuckle.AspNetCore*.dll | |
| ./artifacts/package/release/* | |
| - name: Publish NuGet packages | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: packages-${{ runner.os }} | |
| path: ./artifacts/package/release | |
| if-no-files-found: error | |
| - name: Get .NET tools versions | |
| id: get-dotnet-tools-versions | |
| shell: pwsh | |
| run: | | |
| $manifest = (Get-Content "./.config/dotnet-tools.json" | Out-String | ConvertFrom-Json) | |
| $dotnetValidateVersion = $manifest.tools.'dotnet-validate'.version | |
| $nugetPackageValidationVersion = $manifest.tools.'meziantou.framework.nugetpackagevalidation.tool'.version | |
| "dotnet-validate-version=${dotnetValidateVersion}" >> ${env:GITHUB_OUTPUT} | |
| "nuget-package-validation-version=${nugetPackageValidationVersion}" >> ${env:GITHUB_OUTPUT} | |
| validate-packages: | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: packages-Windows | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| with: | |
| dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
| - name: Install NuGet package validation tools | |
| shell: pwsh | |
| env: | |
| DOTNET_VALIDATE_VERSION: ${{ needs.build.outputs.dotnet-validate-version }} | |
| NUGET_PACKAGE_VALIDATION_VERSION: ${{ needs.build.outputs.nuget-package-validation-version }} | |
| run: | | |
| dotnet tool install --global dotnet-validate --version ${env:DOTNET_VALIDATE_VERSION} --allow-roll-forward | |
| dotnet tool install --global Meziantou.Framework.NuGetPackageValidation.Tool --version ${env:NUGET_PACKAGE_VALIDATION_VERSION} --allow-roll-forward | |
| - name: Validate NuGet packages | |
| shell: pwsh | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| $packages = Get-ChildItem -Filter "*.nupkg" | ForEach-Object { $_.FullName } | |
| $invalidPackages = 0 | |
| foreach ($package in $packages) { | |
| $isValid = $true | |
| dotnet validate package local $package | |
| if ($LASTEXITCODE -ne 0) { | |
| $isValid = $false | |
| } | |
| meziantou.validate-nuget-package $package --github-token ${env:GH_TOKEN} --excluded-rules IconMustBeSet | |
| if ($LASTEXITCODE -ne 0) { | |
| $isValid = $false | |
| } | |
| if (-Not $isValid) { | |
| $invalidPackages++ | |
| } | |
| } | |
| if ($invalidPackages -gt 0) { | |
| Write-Output "::error::$invalidPackages NuGet package(s) failed validation." | |
| exit 1 | |
| } | |
| publish-myget: | |
| needs: [ build, validate-packages ] | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event.repository.fork == false && | |
| (github.ref_name == github.event.repository.default_branch || | |
| github.head_ref == 'dotnet-vnext' || | |
| startsWith(github.ref, 'refs/tags/v')) | |
| environment: | |
| name: MyGet.org | |
| url: https://www.myget.org/gallery/domaindrivendev | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: packages-Windows | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| with: | |
| dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
| - name: Push NuGet packages to MyGet.org | |
| env: | |
| API_KEY: ${{ secrets.MYGET_TOKEN }} | |
| PACKAGE_VERSION: ${{ needs.build.outputs.package-version }} | |
| SOURCE: "https://www.myget.org/F/domaindrivendev/api/v3/index.json" | |
| run: | # zizmor: ignore[use-trusted-publishing] MyGet does not support trusted publishing | |
| dotnet nuget push "*.nupkg" --api-key "${API_KEY}" --skip-duplicate --source "${SOURCE}" && echo "::notice title=myget.org::Published version ${PACKAGE_VERSION} to MyGet." | |
| publish-nuget: | |
| needs: [ build, validate-packages ] | |
| runs-on: ubuntu-latest | |
| if: | | |
| github.event.repository.fork == false && | |
| startsWith(github.ref, 'refs/tags/v') | |
| environment: | |
| name: NuGet.org | |
| url: https://www.nuget.org/profiles/domaindrivendev | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Download packages | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: packages-Windows | |
| - name: Setup .NET SDK | |
| uses: actions/setup-dotnet@c2fa09f4bde5ebb9d1777cf28262a3eb3db3ced7 # v5.2.0 | |
| with: | |
| dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
| - name: NuGet log in | |
| uses: NuGet/login@d22cc5f58ff5b88bf9bd452535b4335137e24544 # v1.1.0 | |
| id: nuget-login | |
| with: | |
| user: ${{ secrets.NUGET_USER }} | |
| - name: Push NuGet packages to NuGet.org | |
| env: | |
| API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }} | |
| PACKAGE_VERSION: ${{ needs.build.outputs.package-version }} | |
| SOURCE: https://api.nuget.org/v3/index.json | |
| run: | | |
| dotnet nuget push "*.nupkg" --api-key "${API_KEY}" --skip-duplicate --source "${SOURCE}" && echo "::notice title=nuget.org::Published version ${PACKAGE_VERSION} to NuGet.org." |