Bump version #745
Workflow file for this run
This file contains 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 ] | |
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 }} | |
outputs: | |
dotnet-sdk-version: ${{ steps.setup-dotnet.outputs.dotnet-version }} | |
dotnet-validate-version: ${{ steps.get-dotnet-tools-versions.outputs.dotnet-validate-version }} | |
permissions: | |
attestations: write | |
contents: read | |
id-token: write | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- macos-latest | |
- ubuntu-latest | |
- windows-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Setup .NET SDKs | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: | | |
6.0.x | |
7.0.x | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
id: setup-dotnet | |
- name: Setup NuGet cache | |
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: ~/.nuget/packages | |
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj', '**/*.props') }} | |
restore-keys: ${{ runner.os }}-nuget- | |
- name: Build, Package and Test | |
shell: pwsh | |
run: | | |
./build.ps1 | |
- name: Upload Coverage Reports | |
if: always() | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
with: | |
name: coverage-${{ runner.os }} | |
path: ./artifacts/coverage | |
if-no-files-found: ignore | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@e28ff129e5465c2c0dcc6f003fc735cb6ae0c673 # v4.5.0 | |
with: | |
files: ./artifacts/coverage/coverage.cobertura.xml | |
flags: ${{ runner.os }} | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Attest artifacts | |
uses: actions/attest-build-provenance@1c608d11d69870c2092266b3f9a6f3abbf17002c # v1.4.3 | |
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/package/release/* | |
- name: Publish NuGet packages | |
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0 | |
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 | |
"dotnet-validate-version=${dotnetValidateVersion}" >> $env:GITHUB_OUTPUT | |
validate-packages: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download packages | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: packages-Windows | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
- name: Validate NuGet packages | |
shell: pwsh | |
env: | |
DOTNET_VALIDATE_VERSION: ${{ needs.build.outputs.dotnet-validate-version }} | |
run: | | |
dotnet tool install --global dotnet-validate --version ${env:DOTNET_VALIDATE_VERSION} | |
$packages = Get-ChildItem -Filter "*.nupkg" | ForEach-Object { $_.FullName } | |
$invalidPackages = 0 | |
foreach ($package in $packages) { | |
dotnet validate package local $package | |
if ($LASTEXITCODE -ne 0) { | |
$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 || | |
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@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: packages-Windows | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
- name: Push NuGet packages to MyGet.org | |
run: | | |
dotnet nuget push "*.nupkg" --api-key ${{ secrets.MYGET_TOKEN }} --skip-duplicate --source https://www.myget.org/F/domaindrivendev/api/v2 | |
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 | |
steps: | |
- name: Download packages | |
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 | |
with: | |
name: packages-Windows | |
- name: Setup .NET SDK | |
uses: actions/setup-dotnet@6bd8b7f7774af54e05809fcc5431931b3eb1ddee # v4.0.1 | |
with: | |
dotnet-version: ${{ needs.build.outputs.dotnet-sdk-version }} | |
- name: Push NuGet packages to NuGet.org | |
run: | | |
dotnet nuget push "*.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate --source https://api.nuget.org/v3/index.json |