Skip to content

Commit

Permalink
Merge pull request #78 from ricaun-io/develop
Browse files Browse the repository at this point in the history
Version 1.9.0
  • Loading branch information
ricaun authored Dec 19, 2024
2 parents 7401e4a + 186a0b6 commit b38e828
Show file tree
Hide file tree
Showing 40 changed files with 2,488 additions and 125 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/Develop.yml → .github/workflows/Build.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,20 @@
# ------------------------------------------------------------------------------
# Develop.yml
# Build.yml
# ------------------------------------------------------------------------------

name: Develop
name: Build

on:
push:
branches-ignore:
- master
pull_request:
branches-ignore:
- master
- main
workflow_dispatch:

jobs:
Develop:
name: Develop
Build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
Expand All @@ -28,5 +27,7 @@ jobs:
NugetApiUrl: ${{ secrets.NUGET_API_URL }}
NugetApiKey: ${{ secrets.NUGET_API_KEY }}

SignFile: ${{ secrets.SIGN_FILE }}
SignPassword: ${{ secrets.SIGN_PASSWORD }}
# SignFile: ${{ secrets.SIGN_FILE }}
# SignPassword: ${{ secrets.SIGN_PASSWORD }}
SignFile: ${{ secrets.SIGN_FILE_AZURE }}
SignPassword: ${{ secrets.SIGN_PASSWORD_AZURE }}
29 changes: 0 additions & 29 deletions .github/workflows/Publish.yml

This file was deleted.

1 change: 1 addition & 0 deletions Build/.nuke/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
temp
5 changes: 5 additions & 0 deletions Build/.nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
"ExecutableTarget": {
"type": "string",
"enum": [
"AzureSignTool",
"Build",
"Clean",
"Compile",
"CompileExample",
"GitPreRelease",
"GitRelease",
"LocalAssetRelease",
"Pack",
"PrePack",
"Release",
Expand Down Expand Up @@ -109,6 +111,9 @@
"allOf": [
{
"properties": {
"EnableForkedRepository": {
"type": "boolean"
},
"Folder": {
"type": "string"
},
Expand Down
4 changes: 3 additions & 1 deletion Build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
using ricaun.Nuke;
using ricaun.Nuke.Components;

class Build : NukeBuild, IPublishPack, ICompileExample, ITest, IShowGitVersion, IPrePack
class Build : NukeBuild, IPublishPack, ICompileExample, ITest, IShowGitVersion, IAzureSignTool, IPrePack, ILocalAssetRelease
{
public void ReleaseAsset(ReleaseAssets releaseAssets) { }
IAssetRelease IHazAssetRelease.AssetRelease => new AssetRelease();
//bool IPack.UnlistNuget => true;
bool ITest.TestBuildStopWhenFailed => false;
public static int Main() => Execute<Build>(x => x.From<IPublishPack>().Build);
Expand Down
1 change: 1 addition & 0 deletions Build/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@
<ItemGroup>
<ProjectReference Include="..\ricaun.Nuke\ricaun.Nuke.csproj" />
</ItemGroup>

</Project>
18 changes: 18 additions & 0 deletions Build/IAzureSignTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Nuke.Common;
using Nuke.Common.Tools.AzureSignTool;
using ricaun.Nuke.Components;
using ricaun.Nuke.Tools.NuGetKeyVaultSignTool;

public interface IAzureSignTool : IClean, ICompile
{
Target AzureSignTool => _ => _
.TriggeredBy(Clean)
.Before(Compile)
.Executes(() =>
{
ricaun.Nuke.Tools.AzureSignToolUtils.EnsureAzureToolIsInstalled();

Serilog.Log.Information(AzureSignToolTasks.AzureSignToolPath);
Serilog.Log.Information(NuGetKeyVaultSignToolTasks.NuGetKeyVaultSignToolPath);
});
}
35 changes: 35 additions & 0 deletions Build/ILocalAssetRelease.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
using Nuke.Common;
using ricaun.Nuke.Components;
using ricaun.Nuke.Extensions;

class AssetRelease : IAssetRelease
{
public void ReleaseAsset(ReleaseAssets releaseAssets)
{
Serilog.Log.Information($"Project: {releaseAssets.Project.Name}");
Serilog.Log.Information($"Version: {releaseAssets.Version}");
Serilog.Log.Information($"Notes: {releaseAssets.Notes}");
Serilog.Log.Information($"Prerelease: {releaseAssets.Prerelease}");
foreach (var file in releaseAssets.Assets)
{
Serilog.Log.Information($"File: {file}");
}
}
}

public interface ILocalAssetRelease : IClean, ICompile, IHazAssetRelease, IAssetRelease
{
Target LocalAssetRelease => _ => _
.TriggeredBy(Clean)
.Before(Compile)
.Executes(() =>
{
var releaseAssets = new ReleaseAssets
{
Project = MainProject,
Version = "0.0.0",
Notes = "Release Notes",
};
ExecuteReleaseAsset(releaseAssets);
});
}
21 changes: 20 additions & 1 deletion Build/IShowGitVersion.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using Nuke.Common;
using Nuke.Common.Git;
using ricaun.Nuke.Components;
using ricaun.Nuke.Extensions;

public interface IShowGitVersion : IHazGitVersion, IHazChangelog, IClean, ICompile
public interface IShowGitVersion : IHazGitVersion, IHazGitRepository, IHazChangelog, IClean, ICompile
{
Target ShowGitVersion => _ => _
.TriggeredBy(Clean)
Expand All @@ -23,5 +24,23 @@ public interface IShowGitVersion : IHazGitVersion, IHazChangelog, IClean, ICompi
System.IO.Path.Combine(BuildAssemblyDirectory, $"latest.json"));
}
catch { }


Serilog.Log.Information("Commit = {Value}", GitRepository.Commit);
Serilog.Log.Information("Branch = {Value}", GitRepository.Branch);
Serilog.Log.Information("Tags = {Value}", GitRepository.Tags);
Serilog.Log.Information("Head = {Value}", GitRepository.Head);
Serilog.Log.Information("Identifier = {Value}", GitRepository.Identifier);

Serilog.Log.Information("IsForked = {Value}", GitRepository.IsForked());

Serilog.Log.Information("main branch = {Value}", GitRepository.IsOnMainBranch());
Serilog.Log.Information("main/master branch = {Value}", GitRepository.IsOnMainOrMasterBranch());
Serilog.Log.Information("release/* branch = {Value}", GitRepository.IsOnReleaseBranch());
Serilog.Log.Information("hotfix/* branch = {Value}", GitRepository.IsOnHotfixBranch());

Serilog.Log.Information("Https URL = {Value}", GitRepository.HttpsUrl);
Serilog.Log.Information("SSH URL = {Value}", GitRepository.SshUrl);

});
}
34 changes: 33 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,39 @@ 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.9.0] / 2024-12-06 - 2024-12-19
### Features
- Enable sign files using `Azure Key Vault`.
- Enable `IAssetRelease` to release assets before `GitRelease` and `GitPreRelease`.
- Enable `SkipForked` to skip release if forked repository.
### Build
- Add `IAzureSignTool` to check if `AzureSignToolUtils` is installed.
- Add `ILocalAssetRelease` to test `AssetRelease` assets before release.
### Updates
- Add version `Information` in the `CommonExtension`.
- Add `AzureSignToolUtils` to sign files using `AzureSignToolTasks` or `NuGetKeyVaultSignToolTasks`.
- Add `NuGetKeyVaultSignTool` for nuke version `8.*`.
- Add `AzureKeyVaultConfig` with json file with `Azure Key Vault` without secrets.
- Add `PackageDownload` to download `AzureSignTool` and `NuGetKeyVaultSignTool` on the fly.
- Add `HttpAuthTasks` to get/post files.
- Update `HttpAuthTasks` docs.
- Update `IsPathTooLong` to equal or greater than `260`.
- Update `SignExtension.Sign` to sign NuGet or files.
- Update `SignProject` to sign files using `Azure Key Vault` if available.
- Update `GetToolInstallationPath` to use user temp folder.
- Update `TestRunUtil` icons to circle with color.
- Update `AzureSignToolUtils` sign to ignore exception.
- Update `AzureSignToolUtils` to ignore if file is already signed.
- Update `HasSignature` to use `PathTooLongUtils` to check if file is signed. (Fix: #77)
- Update `ExecuteReleaseAsset` to execute `IHazAssetRelease` and build with `IAssetRelease`
### Example
- Add `Resource` and `Resource.pt-BR` to test sign files.
### Tests
- Update `NuGetExtensionTests`
- Add `AzureKeyVaultConfigTests`

## [1.8.2] / 2024-11-20
### Update
### Updates
- Update `Nuke.Common` to `8.1.4`.
- Update `FileSystemTasks.CopyFileToDirectory` to `AbsolutePathExtensions.CopyToDirectory`.
- Update `FileSystemTasks.CopyDirectoryRecursively` to `AbsolutePathExtensions.Copy`.
Expand Down Expand Up @@ -358,6 +389,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- First Release

[vNext]: ../../compare/1.0.0...HEAD
[1.9.0]: ../../compare/1.8.2...1.9.0
[1.8.2]: ../../compare/1.8.1...1.8.2
[1.8.1]: ../../compare/1.8.0...1.8.1
[1.8.0]: ../../compare/1.7.4...1.8.0
Expand Down
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.9.0</Version>
</PropertyGroup>
</Project>
46 changes: 44 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ This package is to simplify the build automation system using [Nuke.Common](http
[![Visual Studio 2022](https://img.shields.io/badge/Visual%20Studio-2022-blue)](../..)
[![Nuke](https://img.shields.io/badge/Nuke-Build-blue)](https://nuke.build/)
[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
[![Publish](https://github.com/ricaun-io/ricaun.Nuke/actions/workflows/Publish.yml/badge.svg)](https://github.com/ricaun-io/ricaun.Nuke/actions)
[![Build](https://github.com/ricaun-io/ricaun.Nuke/actions/workflows/Build.yml/badge.svg)](https://github.com/ricaun-io/ricaun.Nuke/actions)
[![Release](https://img.shields.io/nuget/v/ricaun.Nuke?logo=nuget&label=release&color=blue)](https://www.nuget.org/packages/ricaun.Nuke)

# Examples
Expand Down Expand Up @@ -51,7 +51,14 @@ class Build : NukeBuild, IPublishPack

## Environment Variables

### Publish Package Github
### Publish Github

```yml
env:
GitHubToken: ${{ secrets.GITHUB_TOKEN }}
```
### SignFile and SignPassword
```yml
env:
Expand All @@ -60,6 +67,41 @@ env:
SignPassword: ${{ secrets.SIGN_PASSWORD }}
```
`SignFile` could be a `file/url/Base64` to the certificate file.
`SignPassword` is the password to the certificate file.

#### SignFile using `Azure Key Vault`

To simplify the configuration to sign with `Azure Key Vault` using the same environment variables are used `SignFile` and `SignPassword`.

```yml
env:
GitHubToken: ${{ secrets.GITHUB_TOKEN }}
SignFile: ${{ secrets.SIGN_FILE_AZURE }}
SignPassword: ${{ secrets.SIGN_PASSWORD_AZURE }}
```

##### SIGN_FILE_AZURE

The `SIGN_FILE_AZURE` is a `json` with the base configuration of the certificated in the `Azure Key Vault`:

```json
{
"AzureKeyVaultCertificate": "AzureKeyVaultCertificate",
"AzureKeyVaultUrl": "AzureKeyVaultUrl",
"AzureKeyVaultClientId": "AzureKeyVaultClientId",
"AzureKeyVaultTenantId": "AzureKeyVaultTenantId",
"TimestampUrl" : "http://timestamp.digicert.com"
"TimestampDigest" : "sha256"
}
```

The `TimestampUrl` and `TimestampDigest` are optional.

##### SIGN_PASSWORD_AZURE

The `SIGN_PASSWORD_AZURE` is the `AzureKeyVaultClientSecret` of the `Azure Key Vault` certificate.

### Publish Package Nuget

```yml
Expand Down
2 changes: 1 addition & 1 deletion ricaun.Nuke.Example.Tests/ricaun.Nuke.Example.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit b38e828

Please sign in to comment.