diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index da2bee0..840a85a 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -73,66 +73,61 @@ categories: # Using regex for defining rules - https://regexr.com/ # https://stackoverflow.com/questions/58899999/regexp-to-match-conventional-commit-syntax # Note: because of escaping logic inside of release drafter our regex should be escaped correctly and drafter wil un-escape it internally -# - Escaped regex: When writing a regular expression as a string in code, special characters like (, ), and : need to be escaped with a backslash (\) because these characters have special meanings in regex. +# - Escaped regex: When writing a regular expression as a string in code, special characters like (, ), and : need to be escaped with a backslash (\) because these characters have special meanings in regex. # - Unescaped regex: If you use a raw regex literal (i.e., surrounded by slashes /.../), the regex engine interprets it directly, and you don’t need to double-escape the special characters. autolabeler: - label: 'chore' - branch: - - '/^(chore)(\([a-z ]+\))?\/.+/' - title: - - '/^(chore)(\([a-z ]+\))?: .+/' + branch: + - '/^(chore)(\([a-z ]+\))?\/.+/' + title: + - '/^(chore)(\([a-z ]+\))?: .+/' - label: 'enhancement' - branch: - - '/^(refactor)(\([a-z ]+\))?\/.+/' - title: - - '/^(refactor)(\([a-z ]+\))?: .+/' + branch: + - '/^(refactor)(\([a-z ]+\))?\/.+/' + title: + - '/^(refactor)(\([a-z ]+\))?: .+/' - label: 'documentation' - branch: - - '/^(docs)(\([a-z ]+\))?\/.+/' - title: - - '/^(docs)(\([a-z ]+\))?: .+/' + branch: + - '/^(docs)(\([a-z ]+\))?\/.+/' + title: + - '/^(docs)(\([a-z ]+\))?: .+/' - label: 'ci-cd' - branch: - - '/^(ci)(\([a-z ]+\))?\/.+/' - title: - - '/^(ci)(\([a-z ]+\))?: .+/' -- label: 'devops' - branch: - - '/^(ci)(\([a-z ]+\))?\/.+/' - title: - - '/^(ci)(\([a-z ]+\))?: .+/' + branch: + - '/^(ci)(\([a-z ]+\))?\/.+/' + title: + - '/^(ci)(\([a-z ]+\))?: .+/' - label: 'test' - branch: - - '/^(test)(\([a-z ]+\))?\/.+/' - title: - - '/^(test)(\([a-z ]+\))?: .+/' + branch: + - '/^(test)(\([a-z ]+\))?\/.+/' + title: + - '/^(test)(\([a-z ]+\))?: .+/' - label: 'bug' - branch: - - '/^(fix)(\([a-z ]+\))?\/.+/' - title: - - '/^(fix)(\([a-z ]+\))?: .+/' + branch: + - '/^(fix)(\([a-z ]+\))?\/.+/' + title: + - '/^(fix)(\([a-z ]+\))?: .+/' - label: 'style' - branch: - - '/^(style)(\([a-z ]+\))?\/.+/' - title: - - '/^(style)(\([a-z ]+\))?: .+/' + branch: + - '/^(style)(\([a-z ]+\))?\/.+/' + title: + - '/^(style)(\([a-z ]+\))?: .+/' - label: 'feature' - branch: - - '/^(feat)(\([a-z ]+\))?\/.+/' - title: - - '/^(feat)(\([a-z ]+\))?: .+/' + branch: + - '/^(feat)(\([a-z ]+\))?\/.+/' + title: + - '/^(feat)(\([a-z ]+\))?: .+/' - label: 'minor' - branch: - - '/^(feat)(\([a-z ]+\))?\/.+/' - title: - - '/^(feat)(\([a-z ]+\))?: .+/' + branch: + - '/^(feat)(\([a-z ]+\))?\/.+/' + title: + - '/^(feat)(\([a-z ]+\))?: .+/' - label: 'patch' - branch: - - '/^(fix)(\([a-z ]+\))?\/.+/' - - '/^(ci)(\([a-z ]+\))?\/.+/' - title: - - '/^(fix)(\([a-z ]+\))?: .+/' - - '/^(ci)(\([a-z ]+\))?: .+/' + branch: + - '/^(fix)(\([a-z ]+\))?\/.+/' + - '/^(ci)(\([a-z ]+\))?\/.+/' + title: + - '/^(fix)(\([a-z ]+\))?: .+/' + - '/^(ci)(\([a-z ]+\))?: .+/' change-template: '- $TITLE @$AUTHOR (#$NUMBER)' change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks. diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 24e8ea0..dab2fc4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -73,10 +73,12 @@ jobs: # https://github.com/dotnet/Nerdbank.GitVersioning/blob/main/doc/cloudbuild.md#github-actions fetch-depth: 0 # avoid shallow clone so nbgv can do its work. # Download the NuGet package created in the previous job - - uses: actions/download-artifact@v3 + # .nupkg should be in the same folder that we have `.template.config`, so we should put it in the root of source directory + - uses: actions/download-artifact@v4 with: name: nuget - path: ${{ env.NuGetDirectory }} + ## Optional. Default is $GITHUB_WORKSPACE + # path: ${{ github.workspace}} # Install the .NET SDK indicated in the global.json file - name: Setup .NET Core @@ -91,7 +93,7 @@ jobs: # for publish package to github for each commit - name: Publish NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} to GitHub - run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --skip-duplicate --api-key ${{ env.GHC_API_KEY }} --source ${{ env.GHC_SOURCE }} + run: dotnet nuget push *.nupkg --skip-duplicate --api-key ${{ env.GHC_API_KEY }} --source ${{ env.GHC_SOURCE }} if: github.event_name == 'push' && (startswith(github.ref, 'refs/heads') || startswith(github.ref, 'refs/tags')) # Publish all NuGet packages to NuGet.org @@ -99,5 +101,5 @@ jobs: # If you retry a failed workflow, already published packages will be skipped without error. # https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push - name: Publish NuGet Package Version ${{ steps.nbgv.outputs.SemVer2 }} to Nuget - run: dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg --skip-duplicate --source ${{ env.FEED_SOURCE }} --api-key ${{ env.FEED_API_KEY }} + run: dotnet nuget push *.nupkg --skip-duplicate --source ${{ env.FEED_SOURCE }} --api-key ${{ env.FEED_API_KEY }} if: github.event_name == 'push' && startswith(github.ref, 'refs/tags') diff --git a/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs b/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs index 92a7499..a28c4a1 100644 --- a/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs +++ b/src/Shared/Logging/Extensions/DependencyInjectionExtensions.cs @@ -41,7 +41,8 @@ public static WebApplicationBuilder AddCustomSerilog( // https://github.com/serilog/serilog-settings-configuration loggerConfiguration.ReadFrom.Configuration( builder.Configuration, - new ConfigurationReaderOptions {SectionName = nameof(SerilogOptions)}); + new ConfigurationReaderOptions { SectionName = nameof(SerilogOptions) } + ); extraConfigure?.Invoke(loggerConfiguration); @@ -56,16 +57,16 @@ public static WebApplicationBuilder AddCustomSerilog( .Enrich.WithExceptionDetails( new DestructuringOptionsBuilder() .WithDefaultDestructurers() - .WithDestructurers(new[] {new DbUpdateExceptionDestructurer()})); - + .WithDestructurers(new[] { new DbUpdateExceptionDestructurer() }) + ); if (serilogOptions.UseConsole) { // https://github.com/serilog/serilog-sinks-async // https://github.com/lucadecamillis/serilog-sinks-spectre - loggerConfiguration.WriteTo.Async( - writeTo => - writeTo.Spectre(outputTemplate: serilogOptions.LogTemplate)); + loggerConfiguration.WriteTo.Async(writeTo => + writeTo.Spectre(outputTemplate: serilogOptions.LogTemplate) + ); } // https://github.com/serilog/serilog-sinks-async @@ -74,7 +75,7 @@ public static WebApplicationBuilder AddCustomSerilog( // elasticsearch sink internally is async // https://www.nuget.org/packages/Elastic.Serilog.Sinks loggerConfiguration.WriteTo.Elasticsearch( - new[] {new Uri(serilogOptions.ElasticSearchUrl),}, + new[] { new Uri(serilogOptions.ElasticSearchUrl) }, opts => { opts.DataStream = new DataStreamName( @@ -84,17 +85,17 @@ public static WebApplicationBuilder AddCustomSerilog( builder.Environment.EnvironmentName }-{ DateTime.Now - :yyyy-MM}"); + :yyyy-MM}" + ); opts.BootstrapMethod = BootstrapMethod.Failure; opts.ConfigureChannel = channelOpts => - { - channelOpts.BufferOptions = - new BufferOptions - {ExportMaxConcurrency = 10}; - }; - }); + { + channelOpts.BufferOptions = new BufferOptions { ExportMaxConcurrency = 10 }; + }; + } + ); } // https://github.com/serilog-contrib/serilog-sinks-grafana-loki @@ -104,9 +105,10 @@ public static WebApplicationBuilder AddCustomSerilog( serilogOptions.GrafanaLokiUrl, new[] { - new LokiLabel {Key = "service", Value = "food-delivery"}, + new LokiLabel { Key = "service", Value = "food-delivery" }, }, - ["app"]); + ["app"] + ); } if (!string.IsNullOrEmpty(serilogOptions.SeqUrl)) @@ -124,15 +126,17 @@ public static WebApplicationBuilder AddCustomSerilog( if (!string.IsNullOrEmpty(serilogOptions.LogPath)) { - loggerConfiguration.WriteTo.Async( - writeTo => - writeTo.File( - serilogOptions.LogPath, - outputTemplate: serilogOptions.LogTemplate, - rollingInterval: RollingInterval.Day, - rollOnFileSizeLimit: true)); + loggerConfiguration.WriteTo.Async(writeTo => + writeTo.File( + serilogOptions.LogPath, + outputTemplate: serilogOptions.LogTemplate, + rollingInterval: RollingInterval.Day, + rollOnFileSizeLimit: true + ) + ); } - }); + } + ); return builder; } diff --git a/version.json b/version.json index 57a97ea..1e03bcd 100644 --- a/version.json +++ b/version.json @@ -1,18 +1,18 @@ { - "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", - "version": "1.3.4", - "gitCommitIdShortAutoMinimum": 7, - "nugetPackageVersion": { - "semVer": 2 - }, - "publicReleaseRefSpec": ["^refs/tags/v\\d+\\.\\d+"], - "release": { - "firstUnstableTag": "preview", - "versionIncrement": "minor" - }, - "cloudBuild": { - "buildNumber": { - "enabled": true + "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json", + "version": "1.3.5", + "gitCommitIdShortAutoMinimum": 7, + "nugetPackageVersion": { + "semVer": 2 + }, + "publicReleaseRefSpec": ["^refs/tags/v\\d+\\.\\d+"], + "release": { + "firstUnstableTag": "preview", + "versionIncrement": "minor" + }, + "cloudBuild": { + "buildNumber": { + "enabled": true + } } - } } diff --git a/vertical-slice-template.csproj b/vertical-slice-template.csproj index 76b28f5..cf5f830 100644 --- a/vertical-slice-template.csproj +++ b/vertical-slice-template.csproj @@ -5,7 +5,9 @@ - + + + @@ -35,7 +37,7 @@ - + @@ -43,6 +45,11 @@ + + + + +