Skip to content

Commit

Permalink
Merge pull request #2 from rena0157/develop
Browse files Browse the repository at this point in the history
Attempting initial release on Nuget
  • Loading branch information
rena0157 authored Mar 18, 2021
2 parents 395d128 + d0caad1 commit c55f020
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 7 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: .NET
name: Mapr Build

on:
push:
Expand All @@ -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 }}
32 changes: 30 additions & 2 deletions build/Build.cs
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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";
Expand Down Expand Up @@ -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));
}
});
}
13 changes: 13 additions & 0 deletions src/Mapr/Mapr.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
<PropertyGroup>
<TargetFramework>net5.0</TargetFramework>
<Nullable>enable</Nullable>

</PropertyGroup>

<PropertyGroup>
<Title>Mapr</Title>
<PackageId>Mapr</PackageId>
<Authors>Adam Renaud</Authors>
<Description>A simple object to object mapper, no magic.</Description>
<PackageProjectUrl>https://github.com/rena0157/mapr</PackageProjectUrl>
<PackageLicenseUrl>https://licenses.nuget.org/MIT</PackageLicenseUrl>
<RepositoryUrl>https://github.com/rena0157/mapr</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageTags>Mappr;AutoMapper</PackageTags>
</PropertyGroup>

</Project>

0 comments on commit c55f020

Please sign in to comment.