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
|
- tags
|
||||||
script:
|
script:
|
||||||
- dotnet tool restore
|
- dotnet tool restore
|
||||||
- dotnet nuke NuGetPush --nuget-username "${NUGET_USERNAME}" --nuget-password "${NUGET_PASSWORD}"
|
- dotnet nuke NuGetPush
|
||||||
|
|
|
@ -46,14 +46,6 @@
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"description": "Disables displaying the NUKE logo"
|
"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": {
|
"Partition": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Partition to use on CI"
|
"description": "Partition to use on CI"
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
using System;
|
|
||||||
using JetBrains.Annotations;
|
|
||||||
using NuGet.Versioning;
|
using NuGet.Versioning;
|
||||||
using Nuke.Common;
|
using Nuke.Common;
|
||||||
using Nuke.Common.CI;
|
using Nuke.Common.CI;
|
||||||
|
@ -25,12 +23,6 @@ class Build : NukeBuild
|
||||||
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
|
||||||
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
|
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;
|
[Solution] readonly Solution? Solution;
|
||||||
[GitRepository] readonly GitRepository? GitRepository;
|
[GitRepository] readonly GitRepository? GitRepository;
|
||||||
[GitVersion(NoFetch = true, Framework = "net6.0")] readonly GitVersion? GitVersion;
|
[GitVersion(NoFetch = true, Framework = "net6.0")] readonly GitVersion? GitVersion;
|
||||||
|
@ -107,14 +99,13 @@ class Build : NukeBuild
|
||||||
)));
|
)));
|
||||||
|
|
||||||
Target AddNugetSource => _ => _
|
Target AddNugetSource => _ => _
|
||||||
.OnlyWhenStatic(() => CI != null && !string.IsNullOrEmpty(CI.CommitTag))
|
.OnlyWhenStatic(() => CI != null && !string.IsNullOrEmpty(CI.CommitTag) && !string.IsNullOrEmpty(CI.JobToken))
|
||||||
.OnlyWhenStatic(() => !string.IsNullOrEmpty(NuGetUsername) && !string.IsNullOrEmpty(NuGetPassword))
|
|
||||||
.ProceedAfterFailure()
|
.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(NuGetUsername)
|
.SetUsername("gitlab-ci-token")
|
||||||
.SetPassword(NuGetPassword)
|
.SetPassword(CI!.JobToken)
|
||||||
.EnableStorePasswordInClearText()));
|
.EnableStorePasswordInClearText()));
|
||||||
|
|
||||||
Target NuGetPush => _ => _
|
Target NuGetPush => _ => _
|
||||||
|
|
Loading…
Reference in a new issue