From 6c18036aee8f65358608149bf0b2f65099521d3a Mon Sep 17 00:00:00 2001 From: hsu Date: Sat, 15 Oct 2022 22:36:15 +0800 Subject: [PATCH] updated --- nuke/Build.Github.cs | 10 ++++++---- nuke/Build.cs | 8 +++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/nuke/Build.Github.cs b/nuke/Build.Github.cs index 53d2b52..6aebf1a 100644 --- a/nuke/Build.Github.cs +++ b/nuke/Build.Github.cs @@ -9,6 +9,8 @@ using Octokit; +using Serilog; + using System; using System.IO; using System.Linq; @@ -35,10 +37,10 @@ internal partial class Build .OnlyWhenDynamic(() => GitVersion.BranchName.Equals("main") || GitVersion.BranchName.Equals("origin/main")) .Executes(async () => { - if (string.IsNullOrWhiteSpace(GhAccessToken)) ControlFlow.Fail($"{nameof(GhAccessToken)} is null"); - Logger.Info("Release to github..."); + if (string.IsNullOrWhiteSpace(GhAccessToken)) Assert.Fail($"{nameof(GhAccessToken)} is null"); + Log.Information("Release to github..."); await PublishAndUploadToGitHubRelease(GitVersion); - Logger.Info("Release to github finished."); + Log.Information("Release to github finished."); }); private async Task PublishAndUploadToGitHubRelease(GitVersion git) @@ -73,7 +75,7 @@ private async Task PublishAndUploadToGitHubRelease(GitVersion git) } catch (Exception e) { - Logger.Error(e); + Log.Error(e, null); } // await GitHubTasks.GitHubClient // .Repository.Release diff --git a/nuke/Build.cs b/nuke/Build.cs index a54fad4..92c39b5 100644 --- a/nuke/Build.cs +++ b/nuke/Build.cs @@ -10,6 +10,8 @@ using Nuke.Common.Tools.MSBuild; using Nuke.Common.Utilities.Collections; +using Serilog; + using System; using System.IO; using System.IO.Compression; @@ -130,7 +132,7 @@ protected override void OnBuildInitialized() .DependsOn(Publish) .Executes(() => { - Logger.Info("Delete output.."); + Log.Information("Delete output.."); PublishDirectory.GlobDirectories("**/output").ForEach(DeleteDirectory); }); @@ -164,9 +166,9 @@ protected override void OnBuildInitialized() .Executes(() => { if (HostType != HostType.AzurePipelines) return; - Logger.Info("Upload artifacts to azure..."); + Log.Information("Upload artifacts to azure..."); AzurePipelines .UploadArtifacts("artifacts", "artifacts", ArtifactsDirectory); - Logger.Info("Upload artifacts to azure finished."); + Log.Information("Upload artifacts to azure finished."); }); } \ No newline at end of file