Skip to content

Commit

Permalink
chore: update nuke to v8
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed Jun 6, 2024
1 parent 600642a commit e470240
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 57 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ jobs:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: Run './build.cmd Compile CreateRelease'
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Compile, CreateRelease'
run: ./build.cmd Compile CreateRelease
env:
GithubToken: ${{ secrets.GITHUB_TOKEN }}
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ jobs:
name: windows-latest
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache .nuke/temp, ~/.nuget/packages
uses: actions/cache@v2
- name: 'Cache: .nuke/temp, ~/.nuget/packages'
uses: actions/cache@v3
with:
path: |
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: Run './build.cmd Compile'
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj', '**/Directory.Packages.props') }}
- name: 'Run: Compile'
run: ./build.cmd Compile
4 changes: 2 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Build Schema",
"$ref": "#/definitions/build",
"title": "Build Schema",
"definitions": {
"build": {
"type": "object",
Expand Down Expand Up @@ -140,4 +140,4 @@
}
}
}
}
}
13 changes: 9 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ $TempDirectory = "$PSScriptRoot\\.nuke\temp"

$DotNetGlobalFile = "$PSScriptRoot\\global.json"
$DotNetInstallUrl = "https://dot.net/v1/dotnet-install.ps1"
$DotNetChannel = "Current"
$DotNetChannel = "STS"

$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = 1
$env:DOTNET_CLI_TELEMETRY_OPTOUT = 1
$env:DOTNET_MULTILEVEL_LOOKUP = 0
$env:DOTNET_NOLOGO = 1

###########################################################################
# EXECUTION
Expand Down Expand Up @@ -61,9 +60,15 @@ else {
ExecSafe { & powershell $DotNetInstallFile -InstallDir $DotNetDirectory -Version $DotNetVersion -NoPath }
}
$env:DOTNET_EXE = "$DotNetDirectory\dotnet.exe"
$env:PATH = "$DotNetDirectory;$env:PATH"
}

Write-Output "Microsoft (R) .NET Core SDK version $(& $env:DOTNET_EXE --version)"
Write-Output "Microsoft (R) .NET SDK version $(& $env:DOTNET_EXE --version)"

if (Test-Path env:NUKE_ENTERPRISE_TOKEN) {
& $env:DOTNET_EXE nuget remove source "nuke-enterprise" > $null
& $env:DOTNET_EXE nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password $env:NUKE_ENTERPRISE_TOKEN > $null
}

ExecSafe { & $env:DOTNET_EXE build $BuildProjectFile /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet }
ExecSafe { & $env:DOTNET_EXE run --project $BuildProjectFile --no-build -- $BuildArguments }
13 changes: 9 additions & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@ TEMP_DIRECTORY="$SCRIPT_DIR//.nuke/temp"

DOTNET_GLOBAL_FILE="$SCRIPT_DIR//global.json"
DOTNET_INSTALL_URL="https://dot.net/v1/dotnet-install.sh"
DOTNET_CHANNEL="Current"
DOTNET_CHANNEL="STS"

export DOTNET_CLI_TELEMETRY_OPTOUT=1
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
export DOTNET_MULTILEVEL_LOOKUP=0
export DOTNET_NOLOGO=1

###########################################################################
# EXECUTION
Expand Down Expand Up @@ -54,9 +53,15 @@ else
"$DOTNET_INSTALL_FILE" --install-dir "$DOTNET_DIRECTORY" --version "$DOTNET_VERSION" --no-path
fi
export DOTNET_EXE="$DOTNET_DIRECTORY/dotnet"
export PATH="$DOTNET_DIRECTORY:$PATH"
fi

echo "Microsoft (R) .NET Core SDK version $("$DOTNET_EXE" --version)"
echo "Microsoft (R) .NET SDK version $("$DOTNET_EXE" --version)"

if [[ ! -z ${NUKE_ENTERPRISE_TOKEN+x} && "$NUKE_ENTERPRISE_TOKEN" != "" ]]; then
"$DOTNET_EXE" nuget remove source "nuke-enterprise" &>/dev/null || true
"$DOTNET_EXE" nuget add source "https://f.feedz.io/nuke/enterprise/nuget" --name "nuke-enterprise" --username "PAT" --password "$NUKE_ENTERPRISE_TOKEN" --store-password-in-clear-text &>/dev/null || true
fi

"$DOTNET_EXE" build "$BUILD_PROJECT_FILE" /nodeReuse:false /p:UseSharedCompilation=false -nologo -clp:NoSummary --verbosity quiet
"$DOTNET_EXE" run --project "$BUILD_PROJECT_FILE" --no-build -- "$@"
56 changes: 26 additions & 30 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
using Nuke.Common.Utilities.Collections;
using Octokit;
using Serilog;
using static Nuke.Common.IO.CompressionTasks;
using static Nuke.Common.IO.FileSystemTasks;
using static Nuke.Common.Tools.DotNet.DotNetTasks;

[GitHubActions(
Expand Down Expand Up @@ -49,11 +47,6 @@
[ShutdownDotNetAfterServerBuild]
class Build : NukeBuild
{
/// Support plugins are available for:
/// - JetBrains ReSharper https://nuke.build/resharper
/// - JetBrains Rider https://nuke.build/rider
/// - Microsoft VisualStudio https://nuke.build/visualstudio
/// - Microsoft VSCode https://nuke.build/vscode
public static int Main() => Execute<Build>(x => x.Compile);

protected override void OnBuildInitialized()
Expand Down Expand Up @@ -83,14 +76,17 @@ protected override void OnBuildInitialized()
Log.Information("NuGet Version: {NuGetVersion}", GitVersion.NuGetVersion);
}

[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;
[Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")]
readonly Configuration Configuration = IsLocalBuild ? Configuration.Debug : Configuration.Release;

[Solution(GenerateProjects = true, SuppressBuildProjectCheck = false)] readonly Solution Solution;
[GitRepository] readonly GitRepository GitRepository;
[GitVersion(Framework = "net6.0", NoFetch = true)] readonly GitVersion GitVersion;
[Solution(GenerateProjects = true, SuppressBuildProjectCheck = false)]
readonly Solution Solution;
[GitRepository]
readonly GitRepository GitRepository;
[GitVersion(Framework = "net6.0", NoFetch = true)]
readonly GitVersion GitVersion;

AbsolutePath SourceDirectory => RootDirectory / "src";
AbsolutePath TestsDirectory => RootDirectory / "tests";
AbsolutePath OutputDirectory => RootDirectory / "artifacts";

Target Clean => _ => _
Expand All @@ -99,9 +95,8 @@ protected override void OnBuildInitialized()
{
try
{
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(EnsureCleanDirectory);
TestsDirectory.GlobDirectories("**/bin", "**/obj").ForEach(EnsureCleanDirectory);
OutputDirectory.GlobDirectories("*.*").ForEach(EnsureCleanDirectory);
SourceDirectory.GlobDirectories("**/bin", "**/obj").ForEach(d => d.DeleteDirectory());
OutputDirectory.CreateOrCleanDirectory();
}
catch
{
Expand Down Expand Up @@ -144,11 +139,12 @@ protected override void OnBuildInitialized()
.SetAssemblyVersion(GitVersion.AssemblySemVer)
.SetFileVersion(GitVersion.AssemblySemFileVer)
.SetInformationalVersion(GitVersion.InformationalVersion)
.SetFramework("net5.0-windows")
.SetFramework("net8.0-windows")
.SetRuntime("win-x64")
.DisablePublishTrimmed()
.EnableSelfContained()
.EnablePublishSingleFile()
.EnableDeterministic()
.SetProperty("IncludeNativeLibrariesForSelfExtract", true)
.SetProperty("IncludeAllContentForSelfExtract", true)
);
Expand All @@ -160,13 +156,13 @@ protected override void OnBuildInitialized()
.OnlyWhenStatic(() => EnvironmentInfo.IsWin)
.Executes(() =>
{
Compress(SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net47", OutputDirectory / $"IconPacks.Browser-net47-v{GitVersion.NuGetVersion}.zip");
Compress(SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net5.0-windows" / "win-x64" / "publish", OutputDirectory / $"IconPacks.Browser-net50-v{GitVersion.NuGetVersion}.zip");
(SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net47").ZipTo(OutputDirectory / $"IconPacks.Browser-net47-v{GitVersion.NuGetVersion}.zip");
(SourceDirectory / "IconPacks.Browser" / "bin" / Configuration / "net8.0-windows" / "win-x64" / "publish").ZipTo(OutputDirectory / $"IconPacks.Browser-net8-v{GitVersion.NuGetVersion}.zip");
});

Target SignArtifacts => _ => _
.DependsOn(Publish)
.OnlyWhenStatic(() => EnvironmentInfo.IsWin)
.OnlyWhenStatic(() => EnvironmentInfo.IsWin && !IsLocalBuild)
.Executes(() =>
{
var files = SourceDirectory.GlobFiles("**/bin/**/IconPacks.Browser.exe").Select(p => p.ToString());
Expand Down Expand Up @@ -227,12 +223,12 @@ private void UploadReleaseAssetToGithub(IGitHubClient client, Release release, A
Log.Information("Done Uploading {FileName} to the release", asset.Name);
}

[Parameter("GitHub Api key")] [Secret] string GithubToken = null;
[Parameter] [Secret] readonly string AzureKeyVaultUrl;
[Parameter] [Secret] readonly string AzureKeyVaultClientId;
[Parameter] [Secret] readonly string AzureKeyVaultTenantId;
[Parameter] [Secret] readonly string AzureKeyVaultClientSecret;
[Parameter] [Secret] readonly string AzureKeyVaultCertificate;
[Parameter("GitHub Api key")][Secret] string GithubToken = null;
[Parameter][Secret] readonly string AzureKeyVaultUrl;
[Parameter][Secret] readonly string AzureKeyVaultClientId;
[Parameter][Secret] readonly string AzureKeyVaultTenantId;
[Parameter][Secret] readonly string AzureKeyVaultClientSecret;
[Parameter][Secret] readonly string AzureKeyVaultCertificate;

void SignFiles(IEnumerable<string> files, string description, string descriptionUrl)
{
Expand All @@ -244,11 +240,11 @@ void SignFiles(IEnumerable<string> files, string description, string description
.ToggleNoPageHashing()
.SetTimestampRfc3161Url("http://timestamp.digicert.com")
.SetTimestampDigest(AzureSignToolDigestAlgorithm.sha256)
.SetKeyVaultUrl(EnvironmentInfo.GetParameter<string>(nameof(AzureKeyVaultUrl)))
.SetKeyVaultClientId(EnvironmentInfo.GetParameter<string>(nameof(AzureKeyVaultClientId)))
.SetKeyVaultTenantId(EnvironmentInfo.GetParameter<string>(nameof(AzureKeyVaultTenantId)))
.SetKeyVaultClientSecret(EnvironmentInfo.GetParameter<string>(nameof(AzureKeyVaultClientSecret)))
.SetKeyVaultCertificateName(EnvironmentInfo.GetParameter<string>(nameof(AzureKeyVaultCertificate)))
.SetKeyVaultUrl(EnvironmentInfo.GetVariable<string>(nameof(AzureKeyVaultUrl)))
.SetKeyVaultClientId(EnvironmentInfo.GetVariable<string>(nameof(AzureKeyVaultClientId)))
.SetKeyVaultTenantId(EnvironmentInfo.GetVariable<string>(nameof(AzureKeyVaultTenantId)))
.SetKeyVaultClientSecret(EnvironmentInfo.GetVariable<string>(nameof(AzureKeyVaultClientSecret)))
.SetKeyVaultCertificateName(EnvironmentInfo.GetVariable<string>(nameof(AzureKeyVaultCertificate)))
;

AzureSignToolTasks.AzureSignTool(azureSignToolSettings);
Expand Down
9 changes: 4 additions & 5 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,17 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<NoWarn>CS0649;CS0169</NoWarn>
<NukeRootDirectory>..</NukeRootDirectory>
<NukeScriptDirectory>..</NukeScriptDirectory>
<NukeTelemetryVersion>1</NukeTelemetryVersion>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="6.2.1" />
<PackageReference Include="Nuke.GitHub" Version="3.0.0" />
<PackageDownload Include="AzureSignTool" Version="[3.0.0]" />
<PackageDownload Include="GitVersion.Tool" Version="[5.10.3]" />
<PackageReference Include="Nuke.Common" Version="8.0.0" />
<PackageDownload Include="AzureSignTool" Version="[5.0.0]" />
<PackageDownload Include="GitVersion.Tool" Version="[5.12.0]" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "8.0.300",
"rollForward": "feature"
}
}
}

0 comments on commit e470240

Please sign in to comment.