diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index b65ccb8..3ad2af9 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,4 +1,4 @@
-name: .NET
+name: Mapr Build
on:
push:
@@ -12,10 +12,20 @@ jobs:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
- - name: Setup .NET
+ - uses: actions/checkout@v1
+ - name: Setup .NET 3.1
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 3.1.x
+
+
+ - name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- - name: Nuke Build
- run: /bin/bash ./build.sh
+
+ - name: Nuke
+ run: ./build.sh publish --github-token $GITHUB_TOKEN --nuget-api-key $NUGET_AUTH_TOKEN
+ env:
+ NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/build/Build.cs b/build/Build.cs
index 9f19d8a..f171108 100644
--- a/build/Build.cs
+++ b/build/Build.cs
@@ -1,5 +1,7 @@
+using System.IO;
using Nuke.Common;
using Nuke.Common.CI;
+using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Execution;
using Nuke.Common.Git;
using Nuke.Common.IO;
@@ -20,10 +22,16 @@ class Build : NukeBuild
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
+ [Parameter]
+ readonly string NugetApiKey;
+
+ [Parameter]
+ readonly string GitHubToken;
+
[Solution] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
- [GitVersion(Framework = "netcoreapp3.1")] readonly GitVersion GitVersion;
-
+ [GitVersion(Framework = "netcoreapp3.1", UpdateBuildNumber = true)] readonly GitVersion GitVersion;
+
AbsolutePath SourceDirectory => RootDirectory / "src";
AbsolutePath TestsDirectory => RootDirectory / "tests";
AbsolutePath OutputDirectory => RootDirectory / "output";
@@ -83,4 +91,24 @@ class Build : NukeBuild
.SetInformationalVersion(GitVersion.InformationalVersion)
.SetOutputDirectory(OutputDirectory));
});
+
+ Target Publish => _ => _
+ .DependsOn(Pack)
+ .Executes(() =>
+ {
+ if (GitRepository.IsOnDevelopBranch())
+ {
+ DotNetNuGetPush(p => p
+ .SetTargetPath(OutputDirectory / "*.nupkg")
+ .SetSource("https://nuget.pkg.github.com/rena0157/index.json")
+ .SetApiKey(GitHubToken));
+ }
+ else if (GitRepository.IsOnMasterBranch())
+ {
+ DotNetNuGetPush(p => p
+ .SetTargetPath(OutputDirectory / "*.nupkg")
+ .SetSource("https://api.nuget.org/v3/index.json")
+ .SetApiKey(NugetApiKey));
+ }
+ });
}
\ No newline at end of file
diff --git a/src/Mapr/Mapr.csproj b/src/Mapr/Mapr.csproj
index 2991887..e6fd819 100644
--- a/src/Mapr/Mapr.csproj
+++ b/src/Mapr/Mapr.csproj
@@ -3,6 +3,19 @@
net5.0
enable
+
+
+ Mapr
+ Mapr
+ Adam Renaud
+ A simple object to object mapper, no magic.
+ https://github.com/rena0157/mapr
+ https://licenses.nuget.org/MIT
+ https://github.com/rena0157/mapr
+ git
+ Mappr;AutoMapper
+
+