Skip to content

Commit

Permalink
Add NuGet with delete, verify and sign commands.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Jan 3, 2025
1 parent fbc93c1 commit 95bdd95
Show file tree
Hide file tree
Showing 11 changed files with 1,894 additions and 7 deletions.
3 changes: 3 additions & 0 deletions Build/.nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@
"allOf": [
{
"properties": {
"EnableForkedRepository": {
"type": "boolean"
},
"Folder": {
"type": "string"
},
Expand Down
2 changes: 1 addition & 1 deletion Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ricaun.Nuke" Version="*-*" />
<PackageReference Include="ricaun.Nuke" Version="*" />
<PackageReference Include="Nuke.Tooling.Generator" Version="8.*" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion Build/IGenerateTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public interface IGenerateTools : IClean, ICompile, IHazMainProject, IHazGitRepo
{
GenerateCode(
x,
namespaceProvider: x => $"Nuke.Common.Tools.{x.Name}",
namespaceProvider: x => $"Nuke.Local.Tools.{x.Name}",
sourceFileProvider: x => GitRepository.GetGitHubBrowseUrl(x.SpecificationFile)
);
});
Expand Down
2 changes: 1 addition & 1 deletion Build/INuGetKeyVaultSign.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using Nuke.Common.IO;
using System.IO;
using System.Reflection;
using Nuke.Common.Tools.NuGetKeyVaultSignTool;
using Nuke.Local.Tools.NuGetKeyVaultSignTool;
using Nuke.NuGetKeyVaultSignTool;
using System.Linq;
using Nuke.Common.Tools.NuGet;
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [1.1.0] / 2025-01-03
### Tests
- Add `NuGet` with `delete`, `verify` and `sign` commands.
- Update namespace to `Nuke.Local.Tools` to prevent conflicts with `Nuke.Common` namespace.

## [1.0.0] / 2024-12-04
### Build
- Add `INuGetKeyVaultSign` to test `NuGetKeyVaultSignTool` inside nuke project using `AzureKeyVaultConfig`.
Expand All @@ -18,4 +23,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Add `PackageDownloadUtils` to force download tool package in local tool folder.

[vNext]: ../../compare/1.0.0...HEAD
[1.1.0]: ../../compare/1.0.0...1.1.0
[1.0.0]: ../../compare/1.0.0
2 changes: 1 addition & 1 deletion Nuke.NuGetKeyVaultSignTool/GenerationToolsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Nuke.NuGetKeyVaultSignTool
{
public class GenerationToolsTests
{
const string namespaceProvider = "Nuke.Common.Tools.{0}";
const string namespaceProvider = "Nuke.Local.Tools.{0}";
private static string ToolsDirectory => Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "..", "..", "Tools");
private static string[] GetToolsFiles()
{
Expand Down
2 changes: 1 addition & 1 deletion Nuke.NuGetKeyVaultSignTool/NuGetKeyVaultSignToolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using NUnit.Framework;
using System.IO;
using System.Reflection;
using Nuke.Common.Tools.NuGetKeyVaultSignTool;
using Nuke.Local.Tools.NuGetKeyVaultSignTool;
using Nuke.Common.Tools.AzureSignTool;
using Nuke.CodeGeneration;
using Newtonsoft.Json;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Version>1.1.0</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
1,567 changes: 1,567 additions & 0 deletions Nuke.NuGetKeyVaultSignTool/Tools/NuGet.Generated.cs

Large diffs are not rendered by default.

311 changes: 311 additions & 0 deletions Nuke.NuGetKeyVaultSignTool/Tools/NuGet.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,311 @@
{
"$schema": "https://raw.githubusercontent.com/nuke-build/nuke/master/source/Nuke.Tooling.Generator/schema.json",
"references": [
"https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-pack.md",
"https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-push.md",
"https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-restore.md",
"https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/live/docs/tools/cli-ref-sources.md",
"https://raw.githubusercontent.com/NuGet/docs.microsoft.com-nuget/master/docs/reference/cli-reference/cli-ref-install.md"
],
"name": "NuGet",
"officialUrl": "https://docs.microsoft.com/en-us/nuget/tools/nuget-exe-cli-reference",
"help": "The NuGet Command Line Interface (CLI) provides the full extent of NuGet functionality to install, create, publish, and manage packages.",
"nugetPackageId": "NuGet.CommandLine",
"packageExecutable": "NuGet.exe",
"tasks": [
{
"postfix": "Delete",
"definiteArgument": "delete",
"settingsClass": {
"properties": [
{
"name": "PackageId",
"type": "string",
"format": "{value}",
"help": "Package Id to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted."
},
{
"name": "PackageVersion",
"type": "string",
"format": "{value}",
"help": "Package Version to delete. The exact behavior depends on the source. For local folders, for instance, the package is deleted; for nuget.org the package is unlisted."
},
{
"name": "ApiKey",
"type": "string",
"format": "-ApiKey {value}",
"secret": true,
"help": "The API key for the target repository. If not present, the one specified in <em>%AppData%\\NuGet\\NuGet.Config</em> is used."
},
{
"name": "ConfigFile",
"type": "string",
"format": "-ConfigFile {value}",
"help": "The NuGet configuration file to apply. If not specified, <c>%AppData%\\NuGet\\NuGet.Config</c> (Windows) or <c>~/.nuget/NuGet/NuGet.Config</c> (Mac/Linux) is used."
},
{
"name": "ForceEnglishOutput",
"type": "bool",
"format": "-ForceEnglishOutput",
"help": "<em>(3.5+)</em> Forces nuget.exe to run using an invariant, English-based culture."
},
{
"name": "NonInteractive",
"type": "bool",
"format": "-NonInteractive",
"help": "Suppresses prompts for user input or confirmations."
},
{
"name": "NoPrompt",
"type": "bool",
"format": "-NoPrompt",
"help": "Do not prompt when deleting."
},
{
"name": "Source",
"type": "string",
"format": "-Source {value}",
"help": "Specifies the server URL. NuGet identifies a UNC or local folder source and simply copies the file there instead of pushing it using HTTP. Also, starting with NuGet 3.4.2, this is a mandatory parameter unless the <em>NuGet.Config</em> file specifies a <em>DefaultPushSource</em> value (see <a href=\"https://docs.microsoft.com/en-us/nuget/consume-packages/configuring-nuget-behavior\">Configuring NuGet behavior</a>)."
},
{
"name": "Verbosity",
"type": "NuGetVerbosity",
"format": "-Verbosity {value}",
"help": "Specifies the amount of detail displayed in the output: <em>normal</em>, <em>quiet</em>, <em>detailed</em>."
}
]
}
},
{
"postfix": "Sign",
"definiteArgument": "sign",
"settingsClass": {
"properties": [
{
"name": "TargetPath",
"type": "string",
"format": "{value}",
"help": "Path of the package to sign."
},
{
"name": "CertificateFingerprint",
"type": "string",
"format": "-CertificateFingerprint {value}",
"help": "Specifies the fingerprint to be used to search for the certificate in a local certificate store."
},
{
"name": "CertificatePassword",
"type": "string",
"format": "-CertificatePassword {value}",
"secret": true,
"help": "Specifies the certificate password, if needed. If a certificate is password protected but no password is provided, the command will prompt for a password at run time, unless the -NonInteractive option is passed."
},
{
"name": "CertificatePath",
"type": "string",
"format": "-CertificatePath {value}",
"help": "Specifies the file path to the certificate to be used in signing the package."
},
{
"name": "CertificateStoreLocation",
"type": "string",
"format": "-CertificateStoreLocation {value}",
"help": "Specifies the name of the X.509 certificate store use to search for the certificate. Defaults to 'CurrentUser', the X.509 certificate store used by the current user. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options."
},
{
"name": "CertificateStoreName",
"type": "string",
"format": "-CertificateStoreName {value}",
"help": "Specifies the name of the X.509 certificate store to use to search for the certificate. Defaults to 'My', the X.509 certificate store for personal certificates. This option should be used when specifying the certificate via -CertificateSubjectName or -CertificateFingerprint options."
},
{
"name": "CertificateSubjectName",
"type": "string",
"format": "-CertificateSubjectName {value}",
"help": "Specifies the subject name of the certificate used to search a local certificate store for the certificate. The search is a case-insensitive string comparison using the supplied value, which will find all certificates with the subject name containing that string, regardless of other subject values. The certificate store can be specified by -CertificateStoreName and -CertificateStoreLocation options."
},
{
"name": "HashAlgorithm",
"type": "NuGetSignHashAlgorithm",
"format": "-HashAlgorithm {value}",
"help": "Hash algorithm to be used to sign the package. Defaults to SHA256. Possible values are SHA256, SHA384, and SHA512."
},
{
"name": "OutputDirectory",
"type": "string",
"format": "-OutputDirectory {value}",
"help": "Specifies the directory where the signed package should be saved. By default the original package is overwritten by the signed package."
},
{
"name": "Overwrite",
"type": "bool",
"format": "-Overwrite",
"help": "Switch to indicate if the current signature should be overwritten. By default the command will fail if the package already has a signature."
},
{
"name": "Timestamper",
"type": "string",
"format": "-Timestamper {value}",
"help": "URL to an RFC 3161 timestamping server."
},
{
"name": "TimestampHashAlgorithm",
"type": "NuGetSignHashAlgorithm",
"format": "-TimestampHashAlgorithm {value}",
"help": "Hash algorithm to be used by the RFC 3161 timestamp server. Defaults to SHA256."
},
{
"name": "ConfigFile",
"type": "string",
"format": "-ConfigFile {value}",
"help": "The NuGet configuration file to apply. If not specified, <c>%AppData%\\NuGet\\NuGet.Config</c> (Windows) or <c>~/.nuget/NuGet/NuGet.Config</c> (Mac/Linux) is used."
},
{
"name": "ForceEnglishOutput",
"type": "bool",
"format": "-ForceEnglishOutput",
"help": "<em>(3.5+)</em> Forces nuget.exe to run using an invariant, English-based culture."
},
{
"name": "NonInteractive",
"type": "bool",
"format": "-NonInteractive",
"help": "Suppresses prompts for user input or confirmations."
},
{
"name": "Verbosity",
"type": "NuGetVerbosity",
"format": "-Verbosity {value}",
"help": "Specifies the amount of detail displayed in the output: <em>normal</em>, <em>quiet</em>, <em>detailed</em>."
}
]
}
},
{
"postfix": "Verify",
"definiteArgument": "verify",
"settingsClass": {
"properties": [
{
"name": "Signatures",
"type": "string",
"format": "-Signatures {value}",
"help": "Path of the package to verify Signatures."
},
{
"name": "CertificateFingerprint",
"type": "string",
"format": "-CertificateFingerprint {value}",
"help": "Specifies one or more SHA-256 certificate fingerprints of certificates(s) which signed packages must be signed with. A certificate SHA-256 fingerprint is a SHA-256 hash of the certificate. Multiple inputs should be semicolon separated."
},
{
"name": "ConfigFile",
"type": "string",
"format": "-ConfigFile {value}",
"help": "The NuGet configuration file to apply. If not specified, <c>%AppData%\\NuGet\\NuGet.Config</c> (Windows) or <c>~/.nuget/NuGet/NuGet.Config</c> (Mac/Linux) is used."
},
{
"name": "ForceEnglishOutput",
"type": "bool",
"format": "-ForceEnglishOutput",
"help": "<em>(3.5+)</em> Forces nuget.exe to run using an invariant, English-based culture."
},
{
"name": "NonInteractive",
"type": "bool",
"format": "-NonInteractive",
"help": "Suppresses prompts for user input or confirmations."
},
{
"name": "Verbosity",
"type": "NuGetVerbosity",
"format": "-Verbosity {value}",
"help": "Specifies the amount of detail displayed in the output: <em>normal</em>, <em>quiet</em>, <em>detailed</em>."
}
]
}
}
],
"commonTaskPropertySets": {
"sources": [
{
"name": "ConfigFile",
"type": "string",
"format": "-ConfigFile {value}",
"help": "The NuGet configuration file to apply. If not specified, <c>%AppData%\\NuGet\\NuGet.Config</c> (Windows) or <c>~/.nuget/NuGet/NuGet.Config</c> (Mac/Linux) is used."
},
{
"name": "ForceEnglishOutput",
"type": "bool",
"format": "-ForceEnglishOutput",
"help": "<em>(3.5+)</em> Forces nuget.exe to run using an invariant, English-based culture."
},
{
"name": "NonInteractive",
"type": "bool",
"format": "-NonInteractive",
"help": "Suppresses prompts for user input or confirmations."
},
{
"name": "Verbosity",
"type": "NuGetVerbosity",
"format": "-Verbosity {value}",
"help": "Specifies the amount of detail displayed in the output: <em>normal</em>, <em>quiet</em>, <em>detailed</em>."
}
],
"sources_single": [
{
"name": "Name",
"type": "string",
"format": "-Name {value}",
"help": "Name of the source."
}
],
"sources_add_update": [
{
"name": "Source",
"type": "string",
"format": "-Source {value}",
"help": "URL of the source."
},
{
"name": "Password",
"type": "string",
"format": "-Password {value}",
"secret": true,
"help": "Specifies the password for authenticating with the source."
},
{
"name": "StorePasswordInClearText",
"type": "bool",
"format": "-StorePasswordInClearText",
"secret": false,
"help": "Indicates to store the password in unencrypted text instead of the default behavior of storing an encrypted form."
},
{
"name": "UserName",
"type": "string",
"format": "-UserName {value}",
"help": "Specifies the user name for authenticating with the source."
}
]
},
"enumerations": [
{
"name": "NuGetVerbosity",
"values": [
"Normal",
"Quiet",
"Detailed"
]
},
{
"name": "NuGetSignHashAlgorithm",
"values": [
"sha256",
"sha384",
"sha512"
]
}
]
}
Loading

0 comments on commit 95bdd95

Please sign in to comment.