Skip to content

Commit

Permalink
GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
eaba committed Jul 21, 2022
1 parent d604dec commit 97205c9
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -522,8 +522,7 @@ void CoreTest(string projectName)
.DependsOn(CreateNuget)
.Requires(() => NugetApiUrl)
.Requires(() => !NugetApiKey.IsNullOrEmpty())
.Triggers(GitHubRelease)
.Executes(() =>
.Executes(async() =>
{
var packages = OutputNuget.GlobFiles("*.nupkg", "*.symbols.nupkg").NotNull();
foreach (var package in packages)
Expand All @@ -534,26 +533,14 @@ void CoreTest(string projectName)
.SetSource(NugetApiUrl)
.SetApiKey(NugetApiKey));
}
await GitHubRelease();
});

Target AuthenticatedGitHubClient => _ => _
.Unlisted()
.OnlyWhenDynamic(() => !string.IsNullOrWhiteSpace(GitHubActions.Token))
.Executes(() =>
async Task GitHubRelease ()
{
GitHubClient = new GitHubClient(new ProductHeaderValue("nuke-build"))
{
Credentials = new Credentials(GitHubActions.Token, AuthenticationType.Bearer)
};
});
Target GitHubRelease => _ => _
.Unlisted()
.Description("Creates a GitHub release (or amends existing) and uploads the artifact")
.OnlyWhenDynamic(() => !string.IsNullOrWhiteSpace(GitHubActions.Token))
.DependsOn(AuthenticatedGitHubClient)
.Executes(async () =>
{
var version = GitVersion.NuGetVersionV2;
var releaseNotes = GetNuGetReleaseNotes(ChangelogFile);
Release release;
Expand Down Expand Up @@ -590,7 +577,7 @@ void CoreTest(string projectName)
var releaseAsset = await GitHubClient.Repository.Release.UploadAsset(release, releaseAssetUpload);
Information($" {releaseAsset.BrowserDownloadUrl}");
}
});
}
private string MajorMinorPatchVersion => GitVersion.MajorMinorPatch;

string ParseReleaseNote()
Expand Down

0 comments on commit 97205c9

Please sign in to comment.