diff --git a/CHANGELOG.md b/CHANGELOG.md index 25809b5..25ed8d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,19 +10,20 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Update `FileSystemTasks.CopyDirectoryRecursively` to `AbsolutePathExtensions.CopyToDirectory`. - Add `SymbolPackageFormat` and `IncludeSymbols` in the package. - Update release `*.nupkg` to `*.*nupkg` to copy symbol package format. (Fix: #75) +- Add `WarningSignFile` to show warning when sign file is empty. (Fix: #74) -## [1.8.1] / 2024-05-13 +## [1.8.1] / 2024-05-13 ### Updated - Update `GetFileVersionInfo` to find `exe` file. - Update `SignProject` to sign `Name`, `AssemblyName`, or `*`. - Update `AssemblyExtension` methods to `Obsolete`. -## [1.8.0] / 2024-03-11 +## [1.8.0] / 2024-03-11 ### Updated - Update `Nuke.Common` Version = `8.0.0` - Force enable `EnableUnsafeBinaryFormatterSerialization` to support `net8.0`. -## [1.7.4] / 2024-02-08 +## [1.7.4] / 2024-02-08 ### Features - Update `GetInformationalVersion` to find `nupkg` files. ### Added diff --git a/ricaun.Nuke/Components/IHazSign.cs b/ricaun.Nuke/Components/IHazSign.cs index 7b762cf..bc20d1a 100644 --- a/ricaun.Nuke/Components/IHazSign.cs +++ b/ricaun.Nuke/Components/IHazSign.cs @@ -31,6 +31,14 @@ public bool SignProject(Project project) return SignFolder(projectFolder, $"*{project.Name}*") || SignFolder(projectFolder, $"*{project.GetAssemblyName()}*") || SignFolder(projectFolder); } + internal static bool _waningSignFile = false; + internal void WarningSignFile(string message) + { + if (_waningSignFile) return; + _waningSignFile = true; + Serilog.Log.Warning(message); + } + /// /// Sign Files on the Folder /// @@ -42,8 +50,16 @@ public bool SignProject(Project project) /// public bool SignFolder(string folder, string namePattern = "*", bool dllSign = true, bool nupkgSign = true, bool exeSign = true) { - if (!SignFile.SkipEmpty()) return false; - if (!SignPassword.SkipEmpty()) return false; + if (!SignFile.SkipEmpty()) + { + WarningSignFile("SignFile is empty, SignFolder will be skipped. Configure environment variables 'SIGN_FILE' and 'SIGN_PASSWORD'."); + return false; + } + if (!SignPassword.SkipEmpty()) + { + WarningSignFile("SignPassword is empty, SignFolder will be skipped. Configure environment variables 'SIGN_FILE' and 'SIGN_PASSWORD'."); + return false; + } var certPath = SignExtension.VerifySignFile(SignFile, BuildAssemblyDirectory); var certPassword = SignPassword;