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 - tags
script: script:
- dotnet tool restore - dotnet tool restore
- dotnet nuke Publish - dotnet nuke NuGetPush

View file

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