Skip to content

Commit

Permalink
Add WarningSignFile
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Nov 20, 2024
1 parent 65b5e15 commit 9493a01
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 18 additions & 2 deletions ricaun.Nuke/Components/IHazSign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/// <summary>
/// Sign Files on the Folder
/// </summary>
Expand All @@ -42,8 +50,16 @@ public bool SignProject(Project project)
/// <returns></returns>
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;
Expand Down

0 comments on commit 9493a01

Please sign in to comment.