-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
13 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,36 @@ | ||
using System.Collections.Generic; | ||
|
||
using Nuke.Common; | ||
using Nuke.Common.Git; | ||
using Nuke.Common.IO; | ||
using Nuke.Common.Tooling; | ||
using Nuke.Common.Tools.DotNet; | ||
using Nuke.Components; | ||
using static Nuke.Common.Tools.DotNet.DotNetTasks; | ||
|
||
public partial class Build | ||
{ | ||
string NuGetSource => "https://api.nuget.org/v3/index.json"; | ||
[Parameter] [Secret] string NuGetApiKey; | ||
|
||
string MyGetGetSource => "https://www.myget.org/F/test262harness/api/v2/package"; | ||
[Parameter] [Secret] string MyGetApiKey; | ||
|
||
string ApiKeyToUse => IsTaggedBuild ? NuGetApiKey : MyGetApiKey; | ||
string SourceToUse => IsTaggedBuild ? NuGetSource : MyGetGetSource; | ||
string ApiKeyToUse => IsTaggedBuild ? ((IPublish) this).NuGetApiKey : MyGetApiKey; | ||
string SourceToUse => IsTaggedBuild ? ((IPublish) this).NuGetSource : MyGetGetSource; | ||
|
||
Target Publish => _ => _ | ||
.OnlyWhenDynamic(() => IsRunningOnWindows && (GitRepository.IsOnMainOrMasterBranch() || IsTaggedBuild)) | ||
public Target Publish => _ => _ | ||
.OnlyWhenDynamic(() => !IsRunningOnWindows && (GitRepository.IsOnMainOrMasterBranch() || IsTaggedBuild)) | ||
.DependsOn<IPack>() | ||
.Requires(() => NuGetApiKey, () => MyGetApiKey) | ||
.Requires(() => ((IPublish) this).NuGetApiKey, () => MyGetApiKey) | ||
.Executes(() => | ||
{ | ||
DotNetNuGetPush(_ => _ | ||
.Apply(PushSettingsBase) | ||
.Apply(PushSettings) | ||
.CombineWith(PushPackageFiles, (_, v) => _ | ||
.Apply(((IPublish) this).PushSettingsBase) | ||
.Apply(((IPublish) this).PushSettings) | ||
.CombineWith(((IPublish) this).PushPackageFiles, (_, v) => _ | ||
.SetTargetPath(v)) | ||
.Apply(PackagePushSettings), | ||
PushDegreeOfParallelism, | ||
PushCompleteOnFailure); | ||
.Apply(((IPublish) this).PackagePushSettings), | ||
((IPublish) this).PushDegreeOfParallelism, | ||
((IPublish) this).PushCompleteOnFailure); | ||
}); | ||
|
||
Configure<DotNetNuGetPushSettings> PushSettingsBase => _ => _ | ||
public Configure<DotNetNuGetPushSettings> PushSettings => _ => _ | ||
.SetSource(SourceToUse) | ||
.SetApiKey(ApiKeyToUse) | ||
.EnableSkipDuplicate(); | ||
|
||
Configure<DotNetNuGetPushSettings> PushSettings => _ => _; | ||
Configure<DotNetNuGetPushSettings> PackagePushSettings => _ => _; | ||
|
||
IEnumerable<AbsolutePath> PushPackageFiles => ArtifactsDirectory.GlobFiles("*.nupkg"); | ||
|
||
bool PushCompleteOnFailure => true; | ||
int PushDegreeOfParallelism => 2; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters