Fix NuGet publish credentials
This commit is contained in:
parent
9191cbaa9f
commit
48a94cb1aa
3 changed files with 4 additions and 21 deletions
|
@ -58,4 +58,4 @@ nuget-publish:
|
|||
- tags
|
||||
script:
|
||||
- dotnet tool restore
|
||||
- dotnet nuke NuGetPush --nuget-username "${NUGET_USERNAME}" --nuget-password "${NUGET_PASSWORD}"
|
||||
- dotnet nuke NuGetPush
|
||||
|
|
|
@ -46,14 +46,6 @@
|
|||
"type": "boolean",
|
||||
"description": "Disables displaying the NUKE logo"
|
||||
},
|
||||
"nuget-password": {
|
||||
"type": "string",
|
||||
"description": "Password to use for publishing NuGet packages"
|
||||
},
|
||||
"nuget-username": {
|
||||
"type": "string",
|
||||
"description": "Username to use for publishing NuGet packages"
|
||||
},
|
||||
"Partition": {
|
||||
"type": "string",
|
||||
"description": "Partition to use on CI"
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
using System;
|
||||
using JetBrains.Annotations;
|
||||
using NuGet.Versioning;
|
||||
using Nuke.Common;
|
||||
using Nuke.Common.CI;
|
||||
|
@ -25,12 +23,6 @@ class Build : NukeBuild
|
|||
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
||||
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
|
||||
|
||||
[Parameter("Username to use for publishing NuGet packages", Name = "nuget-username")]
|
||||
string NuGetUsername { get; set; } = Environment.GetEnvironmentVariable("NUGET_USERNAME") ?? string.Empty;
|
||||
|
||||
[Parameter("Password to use for publishing NuGet packages", Name = "nuget-password")]
|
||||
string NuGetPassword { get; set; } = Environment.GetEnvironmentVariable("NUGET_PASSWORD") ?? string.Empty;
|
||||
|
||||
[Solution] readonly Solution? Solution;
|
||||
[GitRepository] readonly GitRepository? GitRepository;
|
||||
[GitVersion(NoFetch = true, Framework = "net6.0")] readonly GitVersion? GitVersion;
|
||||
|
@ -107,14 +99,13 @@ class Build : NukeBuild
|
|||
)));
|
||||
|
||||
Target AddNugetSource => _ => _
|
||||
.OnlyWhenStatic(() => CI != null && !string.IsNullOrEmpty(CI.CommitTag))
|
||||
.OnlyWhenStatic(() => !string.IsNullOrEmpty(NuGetUsername) && !string.IsNullOrEmpty(NuGetPassword))
|
||||
.OnlyWhenStatic(() => CI != null && !string.IsNullOrEmpty(CI.CommitTag) && !string.IsNullOrEmpty(CI.JobToken))
|
||||
.ProceedAfterFailure()
|
||||
.Executes(() => DotNetNuGetAddSource(s => s
|
||||
.SetName(NuGetSourceName)
|
||||
.SetSource($"https://gitlab.com/api/v4/projects/{CI?.ProjectId}/packages/nuget/index.json")
|
||||
.SetUsername(NuGetUsername)
|
||||
.SetPassword(NuGetPassword)
|
||||
.SetUsername("gitlab-ci-token")
|
||||
.SetPassword(CI!.JobToken)
|
||||
.EnableStorePasswordInClearText()));
|
||||
|
||||
Target NuGetPush => _ => _
|
||||
|
|
Loading…
Reference in a new issue