Fix NuGet push in CI

This commit is contained in:
Peter 2021-02-22 16:26:04 +01:00
parent 428c414f7a
commit 52fe1b54e6
Signed by: prskr
GPG key ID: C1DB5D2E8DB512F9
2 changed files with 14 additions and 9 deletions

View file

@ -28,4 +28,4 @@ nuget-publish:
- tags
script:
- dotnet tool restore
- dotnet nuke Publish
- dotnet nuke NuGetPush

View file

@ -91,11 +91,13 @@ class Build : NukeBuild
Target AddNugetSource => _ => _
.OnlyWhenStatic(() => GitRepository.IsOnMasterBranch())
.OnlyWhenStatic(() => CI != null)
.ProceedAfterFailure()
.Executes(() => DotNetNuGetAddSource(s => s
.SetName(NuGetSourceName)
.SetSource($"https://gitlab.com/api/v4/projects/{CI.ProjectId}/packages/nuget/index.json")
.SetUsername("gitlab-ci-token")
.SetPassword(CI.JobToken)
//.SetSource($"https://gitlab.com/api/v4/projects/{CI.ProjectId}/packages/nuget/index.json")
.SetSource($"https://gitlab.com/api/v4/projects/24385200/packages/nuget/index.json")
.SetUsername("baez90")
.SetPassword("RcMwfaXgvBxSWt4ZMB6z")
.EnableStorePasswordInClearText()));
Target Pack => _ => _
@ -115,10 +117,13 @@ class Build : NukeBuild
.EnableProcessLogOutput()
)));
Target Publish => _ => _
Target NuGetPush => _ => _
.DependsOn(Pack, AddNugetSource)
.Executes(() => DotNetPublish(s => s
.EnableNoRestore()
.SetSources(NuGetSourceName)
.SetConfiguration(Configuration)));
.OnlyWhenStatic(() => GitRepository.IsOnMasterBranch())
.Executes(() => ArtifactsDirectory
.GlobFiles("**/*.nupkg")
.ForEach(nupkg => DotNetNuGetPush(s => s
.SetSource(NuGetSourceName)
.SetTargetPath(nupkg)
.EnableProcessLogOutput())));
}