Skip to content

Commit

Permalink
Merge pull request #7 from rena0157/update-build
Browse files Browse the repository at this point in the history
Update build
  • Loading branch information
rena0157 authored Dec 7, 2021
2 parents 3715694 + 70ae7da commit 2413810
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 36 deletions.
12 changes: 4 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
name: Mapr Build
name: Mapr Build & Nuget Push

on:
push:
branches: [ main, develop, release/* ]
pull_request:
branches: [ main, develop, release/* ]
tags:
- 'v*'

jobs:
build:

runs-on: ubuntu-latest

steps:
Expand All @@ -18,14 +16,12 @@ jobs:
with:
dotnet-version: 3.1.x


- name: Setup .NET 5.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x

- name: Nuke
run: ./build.sh publish --github-token $GITHUB_TOKEN --nuget-api-key $NUGET_AUTH_TOKEN
run: ./build.sh publish --nuget-api-key $NUGET_AUTH_TOKEN
env:
NUGET_AUTH_TOKEN: ${{secrets.NUGET_API_KEY}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 0 additions & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
mode: ContinuousDelivery
next-version: 0.3.0
branches: {}
ignore:
sha: []
Expand Down
32 changes: 5 additions & 27 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ class Build : NukeBuild
[Parameter]
readonly string NugetApiKey;

[Parameter]
readonly string GitHubToken;

[Solution] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
[GitVersion(Framework = "netcoreapp3.1", UpdateBuildNumber = true)] readonly GitVersion GitVersion;
Expand Down Expand Up @@ -70,7 +67,7 @@ class Build : NukeBuild
.Executes(() =>
{
DotNetTest(t => t
.SetCollectCoverage(true)
.EnableCollectCoverage()
.SetCoverletOutputFormat(CoverletOutputFormat.cobertura)
.SetProjectFile(Solution)
);
Expand All @@ -95,28 +92,9 @@ class Build : NukeBuild
.DependsOn(Pack)
.Executes(() =>
{
if (GitRepository.IsOnDevelopBranch() || GitRepository.IsOnReleaseBranch())
{
DotNetNuGetPush(p => p
.SetTargetPath(OutputDirectory / "*.nupkg")
.SetSource("https://nuget.pkg.github.com/rena0157/index.json")
.SetApiKey(GitHubToken));
}
else if (GitRepository.Branch?.EqualsOrdinalIgnoreCase("main") ?? false)
{
DotNetNuGetPush(p => p
.SetTargetPath(OutputDirectory / "*.nupkg")
.SetSource("https://api.nuget.org/v3/index.json")
.SetApiKey(NugetApiKey));

DotNetNuGetPush(p => p
.SetTargetPath(OutputDirectory / "*.nupkg")
.SetSource("https://nuget.pkg.github.com/rena0157/index.json")
.SetApiKey(GitHubToken));
}
else
{
Logger.Log(LogLevel.Normal, "No packages where released");
}
DotNetNuGetPush(p => p
.SetTargetPath(OutputDirectory / "*.nupkg")
.SetSource("https://api.nuget.org/v3/index.json")
.SetApiKey(NugetApiKey));
});
}

0 comments on commit 2413810

Please sign in to comment.