diff --git a/.github/workflows/ci-deploy.yml b/.github/workflows/ci-deploy.yml index 37f8b9c..deb32b6 100644 --- a/.github/workflows/ci-deploy.yml +++ b/.github/workflows/ci-deploy.yml @@ -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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3210bca..6dd51dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index cc33185..7d59cb2 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -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", @@ -140,4 +140,4 @@ } } } -} \ No newline at end of file +} diff --git a/build.ps1 b/build.ps1 index 1c774e5..4634dc0 100644 --- a/build.ps1 +++ b/build.ps1 @@ -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 @@ -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 } diff --git a/build.sh b/build.sh index e8961f9..fdff0c6 100755 --- a/build.sh +++ b/build.sh @@ -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 @@ -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 -- "$@" diff --git a/build/Build.cs b/build/Build.cs index 510217f..7529af1 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -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( @@ -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(x => x.Compile); protected override void OnBuildInitialized() @@ -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 => _ => _ @@ -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 { @@ -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) ); @@ -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()); @@ -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 files, string description, string descriptionUrl) { @@ -244,11 +240,11 @@ void SignFiles(IEnumerable files, string description, string description .ToggleNoPageHashing() .SetTimestampRfc3161Url("http://timestamp.digicert.com") .SetTimestampDigest(AzureSignToolDigestAlgorithm.sha256) - .SetKeyVaultUrl(EnvironmentInfo.GetParameter(nameof(AzureKeyVaultUrl))) - .SetKeyVaultClientId(EnvironmentInfo.GetParameter(nameof(AzureKeyVaultClientId))) - .SetKeyVaultTenantId(EnvironmentInfo.GetParameter(nameof(AzureKeyVaultTenantId))) - .SetKeyVaultClientSecret(EnvironmentInfo.GetParameter(nameof(AzureKeyVaultClientSecret))) - .SetKeyVaultCertificateName(EnvironmentInfo.GetParameter(nameof(AzureKeyVaultCertificate))) + .SetKeyVaultUrl(EnvironmentInfo.GetVariable(nameof(AzureKeyVaultUrl))) + .SetKeyVaultClientId(EnvironmentInfo.GetVariable(nameof(AzureKeyVaultClientId))) + .SetKeyVaultTenantId(EnvironmentInfo.GetVariable(nameof(AzureKeyVaultTenantId))) + .SetKeyVaultClientSecret(EnvironmentInfo.GetVariable(nameof(AzureKeyVaultClientSecret))) + .SetKeyVaultCertificateName(EnvironmentInfo.GetVariable(nameof(AzureKeyVaultCertificate))) ; AzureSignToolTasks.AzureSignTool(azureSignToolSettings); diff --git a/build/_build.csproj b/build/_build.csproj index c776ad9..cefe8bd 100644 --- a/build/_build.csproj +++ b/build/_build.csproj @@ -2,7 +2,7 @@ Exe - net6.0 + net8.0 CS0649;CS0169 .. .. @@ -10,10 +10,9 @@ - - - - + + + diff --git a/global.json b/global.json index 7eb9bc5..fe5f13d 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "8.0.100", + "version": "8.0.300", "rollForward": "feature" } -} \ No newline at end of file +}