diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 00fb8a5..c9febb4 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,66 +12,62 @@ jobs: if: "! contains(toJSON(github.event.commits.*.message), '[skip-ci]')" steps: - - name: Checkout uses: actions/checkout@master + with: + fetch-depth: 0 - name: Extract branch name id: extract_branch shell: powershell run: Write-Host ([string]::Format("##[set-output name=branch;]{0}", $env:GITHUB_REF.Replace("refs/heads/", ""))) + + - name: Install GitVersion + uses: gittools/actions/gitversion/setup@v0.9.7 + with: + versionSpec: '5.5.1' + + - name: Determine Version + id: gitversion + uses: gittools/actions/gitversion/execute@v0.9.7 + with: + useConfigFile: true + + - name: Install NuGet client + uses: nuget/setup-nuget@v1 + with: + nuget-version: '5.x' - name: Run the Cake script id: cake - uses: ecampidoglio/cake-action@master + uses: cake-build/cake-action@master with: cake-bootstrap: true - - - name: Install NuGet client - uses: warrenbuckley/Setup-Nuget@v1 + verbosity: Diagnostic + arguments: | + fullSemVer: ${{steps.gitversion.outputs.fullSemVer}} + assemblySemVer: ${{steps.gitversion.outputs.assemblySemVer}} + informationalVersion: ${{steps.gitversion.outputs.informationalVersion}} - name: Add private GitHub registry to NuGet run: nuget sources add -name "GPR" -Source https://nuget.pkg.github.com/dustinchilson/index.json -Username dustinchilson -Password ${{ secrets.GITHUB_TOKEN }} - name: Push generated package to GitHub registry - run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg -Source "GPR" -SkipDuplicate + run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{steps.gitversion.outputs.fullSemVer}}.nupkg -Source "GPR" -SkipDuplicate - name: Push generated package to nuget.org if: steps.extract_branch.outputs.branch == 'main' - run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg -ApiKey ${{ secrets.NUGET_ORG_API_KEY }} -Source https://api.nuget.org/v3/index.json + run: nuget push ./artifacts/NLog.Targets.GraylogHttp.${{steps.gitversion.outputs.fullSemVer}}.nupkg -ApiKey ${{secrets.NUGET_ORG_API_KEY}} -Source https://api.nuget.org/v3/index.json - name: Create Release if: steps.extract_branch.outputs.branch == 'main' id: create_release uses: actions/create-release@master env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} with: - tag_name: v${{ env.GIT_VERSION }} - release_name: Release v${{ env.GIT_VERSION }} + tag_name: v${{steps.gitversion.outputs.fullSemVer}} + release_name: Release v${{steps.gitversion.outputs.fullSemVer}} draft: false prerelease: false - - - name: Upload Test Results - if: steps.extract_branch.outputs.branch == 'main' - id: upload-test-results - uses: actions/upload-release-asset@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./artifacts/TestResults.xml - asset_name: TestResults.xml - asset_content_type: application/xml - - - name: Upload Nuget Package - if: steps.extract_branch.outputs.branch == 'main' - id: upload-nuget-package - uses: actions/upload-release-asset@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./artifacts/NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg - asset_name: NLog.Targets.GraylogHttp.${{ env.GIT_VERSION }}.nupkg - asset_content_type: application/xml \ No newline at end of file + body: https://www.nuget.org/packages/NLog.Targets.GraylogHttp/${{steps.gitversion.outputs.fullSemVer}} \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props index f590e5f..8f5ffed 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -23,9 +23,9 @@ - + - + diff --git a/GitVersion.yml b/GitVersion.yml index 92f0a8a..195b2c0 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,4 @@ -next-version: 1.0 +next-version: 2.0 assembly-versioning-scheme: MajorMinor commit-message-incrementing: Disabled @@ -7,4 +7,4 @@ continuous-delivery-fallback-tag: '' mode: ContinuousDeployment ignore: - sha: [] + sha: [] \ No newline at end of file diff --git a/NLog.Targets.GraylogHttp.sln b/NLog.Targets.GraylogHttp.sln index 746b49b..79af848 100644 --- a/NLog.Targets.GraylogHttp.sln +++ b/NLog.Targets.GraylogHttp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26430.14 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30320.27 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NLog.Targets.GraylogHttp", "src\NLog.Targets.GraylogHttp\NLog.Targets.GraylogHttp.csproj", "{2DA00B6B-A170-419D-AD82-AC139745A11E}" EndProject @@ -9,7 +9,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Misc", "Misc", "{7970F18F-8 ProjectSection(SolutionItems) = preProject .gitignore = .gitignore after.NLog.Targets.GraylogHttp.sln.targets = after.NLog.Targets.GraylogHttp.sln.targets - appveyor.yml = appveyor.yml build.cake = build.cake Directory.Build.props = Directory.Build.props LICENSE = LICENSE diff --git a/README.md b/README.md index 9e3e69e..6f6176c 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,9 @@ This library is packaged as a nuget package available [here](https://www.nuget.o Install-Package NLog.Targets.GraylogHttp ``` -## NetStandard, .Net Core 2.1-3.0, .Net Framework 4.5 +## NetStandard, .Net Core 2.1-5.0, .Net Framework 4.5 -This library runs under netstandard 1.3 and fully supports both .Net Core 2.1-3.0 and .Net Framework 4.5 +This library runs under netstandard 1.3 and fully supports .Net Core 2.1-3.1, .Net 5.0, and .Net Framework 4.5+ ## Usage diff --git a/build.cake b/build.cake index 8aa7226..732ac22 100644 --- a/build.cake +++ b/build.cake @@ -1,12 +1,12 @@ -#addin "nuget:?package=Cake.Json&version=4.0.0" -#addin "nuget:?package=Newtonsoft.Json&version=11.0.2" - // ARGUMENTS var target = Argument("target", "Default"); var configuration = Argument("configuration", "Release"); -var platform = Argument("platform", "Any CPU"); var skipTests = Argument("SkipTests", false); +var fullSemVer = Argument("fullSemVer", "0.0.1"); +var assemblySemVer = Argument("assemblySemVer", "0.0.1"); +var informationalVersion = Argument("informationalVersion", "0.0.1"); + // Variables var artifactsDirectory = Directory("./artifacts"); var solutionFile = "./NLog.Targets.GraylogHttp.sln"; @@ -16,11 +16,11 @@ var msBuildSettings = new DotNetCoreMSBuildSettings MaxCpuCount = 1 }; -GitVersion versionInfo = null; - -////////////////////////////////////////////////////////////////////// -// PREPARATION -////////////////////////////////////////////////////////////////////// +msBuildSettings.Properties.Add("PackageVersion", new List { fullSemVer }); +msBuildSettings.Properties.Add("Version", new List { assemblySemVer }); +msBuildSettings.Properties.Add("FileVersion", new List { assemblySemVer }); +msBuildSettings.Properties.Add("AssemblyVersion", new List { assemblySemVer }); +msBuildSettings.Properties.Add("AssemblyInformationalVersion", new List { informationalVersion }); // Define directories. var buildDir = Directory("./build/bin") + Directory(configuration); @@ -38,39 +38,8 @@ Task("Restore") DotNetCoreRestore(solutionFile); }); -Task("Version") - .Does(() => { - // dotnet tool install --global GitVersion.Tool --version 5.1.2 - DotNetCoreTool("tool", - new DotNetCoreToolSettings { - ArgumentCustomization = args => args.Append("restore") - }); - - // dotnet gitversion /output json - IEnumerable redirectedStandardOutput; - StartProcess( - "dotnet", - new ProcessSettings { - Arguments = "dotnet-gitversion /output json", - RedirectStandardOutput = true - }, - out redirectedStandardOutput - ); - - versionInfo = DeserializeJson(string.Join(Environment.NewLine, redirectedStandardOutput)); - - Information($"::set-env name=GIT_VERSION::{versionInfo.FullSemVer}"); - - msBuildSettings.Properties.Add("PackageVersion", new List { versionInfo.FullSemVer }); - msBuildSettings.Properties.Add("Version", new List { versionInfo.AssemblySemVer }); - msBuildSettings.Properties.Add("FileVersion", new List { versionInfo.AssemblySemVer }); - msBuildSettings.Properties.Add("AssemblyVersion", new List { versionInfo.AssemblySemVer }); - msBuildSettings.Properties.Add("AssemblyInformationalVersion", new List { versionInfo.InformationalVersion }); - }); - Task("Build") .IsDependentOn("Restore") - .IsDependentOn("Version") .Does(() => { var path = MakeAbsolute(new DirectoryPath(solutionFile)); diff --git a/dotnet-tools.json b/dotnet-tools.json index 5979c09..f9a0fa0 100644 --- a/dotnet-tools.json +++ b/dotnet-tools.json @@ -3,10 +3,16 @@ "isRoot": true, "tools": { "gitversion.tool": { - "version": "5.1.2", + "version": "5.5.1", "commands": [ "dotnet-gitversion" ] + }, + "cake.tool": { + "version": "1.0.0-rc0001", + "commands": [ + "dotnet-cake" + ] } } } \ No newline at end of file diff --git a/examples/netcore/NLogGraylogHttp.Example.NetCore/NLogGraylogHttp.Example.NetCore.csproj b/examples/netcore/NLogGraylogHttp.Example.NetCore/NLogGraylogHttp.Example.NetCore.csproj index a3e57c0..a308f29 100644 --- a/examples/netcore/NLogGraylogHttp.Example.NetCore/NLogGraylogHttp.Example.NetCore.csproj +++ b/examples/netcore/NLogGraylogHttp.Example.NetCore/NLogGraylogHttp.Example.NetCore.csproj @@ -2,15 +2,15 @@ Exe - netcoreapp3.0 + net5.0 true false - - - + + + diff --git a/src/NLog.Targets.GraylogHttp.Tests/NLog.Targets.GraylogHttp.Tests.csproj b/src/NLog.Targets.GraylogHttp.Tests/NLog.Targets.GraylogHttp.Tests.csproj index 0f57a9d..c3e7eef 100644 --- a/src/NLog.Targets.GraylogHttp.Tests/NLog.Targets.GraylogHttp.Tests.csproj +++ b/src/NLog.Targets.GraylogHttp.Tests/NLog.Targets.GraylogHttp.Tests.csproj @@ -1,7 +1,7 @@ - netcoreapp2.0 + net5.0 false @@ -15,7 +15,7 @@ - + diff --git a/src/NLog.Targets.GraylogHttp/NLog.Targets.GraylogHttp.csproj b/src/NLog.Targets.GraylogHttp/NLog.Targets.GraylogHttp.csproj index f9ec956..b12254c 100644 --- a/src/NLog.Targets.GraylogHttp/NLog.Targets.GraylogHttp.csproj +++ b/src/NLog.Targets.GraylogHttp/NLog.Targets.GraylogHttp.csproj @@ -15,7 +15,7 @@ - + diff --git a/tools/packages.config b/tools/packages.config index ec87d00..007f90a 100644 --- a/tools/packages.config +++ b/tools/packages.config @@ -1,4 +1,4 @@ - +