diff --git a/.cake-scripts/credentials.cake b/.cake-scripts/credentials.cake index ac48ed046..f97d7e603 100644 --- a/.cake-scripts/credentials.cake +++ b/.cake-scripts/credentials.cake @@ -62,7 +62,7 @@ internal sealed class NuGetCredentials return new NuGetCredentials ( context.EnvironmentVariable("FEED_SOURCE"), - context.EnvironmentVariable("FEED_APIKEY") + context.EnvironmentVariable("FEED_API_KEY") ); } } diff --git a/.cake-scripts/version.cake b/.cake-scripts/version.cake index f2a2bd852..44806fc9a 100644 --- a/.cake-scripts/version.cake +++ b/.cake-scripts/version.cake @@ -25,6 +25,8 @@ internal sealed class BuildInformation var environment = buildSystem.GitHubActions.Environment; + var publishNuGetPackage = context.EnvironmentVariable("PUBLISH_NUGET_PACKAGE"); + var version = context.XmlPeek(propertiesFilePath, "/Project/PropertyGroup[2]/Version/text()"); var git = context.GitBranchCurrent("."); @@ -67,7 +69,7 @@ internal sealed class BuildInformation var isReleaseBuild = GetIsReleaseBuild(branch); - var shouldPublish = GetShouldPublish(branch) && "true".Equals(context.EnvironmentVariable("PUBLISH_NUGET_PACKAGE"), StringComparison.OrdinalIgnoreCase); + var shouldPublish = GetShouldPublish(branch) && ("1".Equals(publishNuGetPackage, StringComparison.Ordinal) || (bool.TryParse(publishNuGetPackage, out var result) && result)); if (isFork && isPullRequest && shouldPublish) { diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 1f741b6bd..23e1c931b 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,7 +3,7 @@ "isRoot": true, "tools": { "cake.tool": { - "version": "2.3.0", + "version": "3.0.0", "commands": [ "dotnet-cake" ] diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index fa2d7e17c..9ff941405 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -86,12 +86,15 @@ jobs: pull-requests: read env: + CODE_SIGNING_CERTIFICATE_BASE64: ${{ secrets.CODE_SIGNING_CERTIFICATE_BASE64 }} + CODE_SIGNING_CERTIFICATE_PASSWORD: ${{ secrets.CODE_SIGNING_CERTIFICATE_PASSWORD }} FEED_SOURCE: https://api.nuget.org/v3/index.json - FEED_APIKEY: ${{ secrets.FEED_APIKEY }} + FEED_API_KEY: ${{ secrets.FEED_API_KEY }} SONARCLOUD_URL: https://sonarcloud.io SONARCLOUD_ORGANIZATION: testcontainers SONARCLOUD_KEY: testcontainers_testcontainers-dotnet SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }} + PUBLISH_NUGET_PACKAGE: ${{ inputs.publish_nuget_package }} steps: - name: Checkout Repository @@ -116,6 +119,9 @@ jobs: Get-ChildItem -Path 'test-coverage' -Filter *.xml | % { (Get-Content $_) -Replace '[A-Za-z0-9:\-\/\\]+tests', '${{ github.workspace }}/tests' | Set-Content $_ } shell: pwsh + - name: Decode Code Signing Certificate + run: echo $CODE_SIGNING_CERTIFICATE_BASE64 | base64 --decode > code-signing-certificate.pfx + - name: Cache NuGet Packages uses: actions/cache@v3 with: @@ -142,8 +148,6 @@ jobs: - name: Publish NuGet Package run: dotnet cake --target=Publish - env: - PUBLISH_NUGET_PACKAGE: ${{ inputs.publish_nuget_package }} - uses: release-drafter/release-drafter@6df64e4ba4842c203c604c1f45246c5863410adb with: diff --git a/Testcontainers.sln b/Testcontainers.sln index ca53e1c48..2ff4adbea 100644 --- a/Testcontainers.sln +++ b/Testcontainers.sln @@ -1,11 +1,11 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 +Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AF017206-CE20-4DDF-8301-CAC68CED1BE6}" -ProjectSection(SolutionItems) = preProject - CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md - CONTRIBUTING.md = CONTRIBUTING.md - README.md = README.md -EndProjectSection + ProjectSection(SolutionItems) = preProject + CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md + CONTRIBUTING.md = CONTRIBUTING.md + README.md = README.md + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{673F23AE-7694-4BB9-ABD4-136D6C13634E}" EndProject diff --git a/build.cake b/build.cake index 0a60c3f41..4dd29b703 100644 --- a/build.cake +++ b/build.cake @@ -1,8 +1,8 @@ -#tool nuget:?package=dotnet-sonarscanner&version=5.8.0 +#tool nuget:?package=dotnet-sonarscanner&version=5.10.0 -#addin nuget:?package=Cake.Sonar&version=1.1.29 +#addin nuget:?package=Cake.Sonar&version=1.1.31 -#addin nuget:?package=Cake.Git&version=2.0.0 +#addin nuget:?package=Cake.Git&version=3.0.0 #load ".cake-scripts/parameters.cake" @@ -132,7 +132,7 @@ Task("Create-NuGet-Packages") .WithCriteria(() => param.ShouldPublish) .Does(() => { - DotNetPack(param.Projects.Testcontainers.Path.FullPath, new DotNetPackSettings + DotNetPack(param.Solution, new DotNetPackSettings { Configuration = param.Configuration, Verbosity = param.Verbosity, @@ -192,6 +192,7 @@ Task("Sonar") Task("Publish") .IsDependentOn("Create-NuGet-Packages") + .IsDependentOn("Sign-NuGet-Packages") .IsDependentOn("Publish-NuGet-Packages"); RunTarget(param.Target); diff --git a/tests/Testcontainers.Commons/Testcontainers.Commons.csproj b/tests/Testcontainers.Commons/Testcontainers.Commons.csproj index f20f75262..94a68b191 100644 --- a/tests/Testcontainers.Commons/Testcontainers.Commons.csproj +++ b/tests/Testcontainers.Commons/Testcontainers.Commons.csproj @@ -2,6 +2,8 @@ netstandard2.0;netstandard2.1 + false + false Debug;Release DotNet.Testcontainers.Commons