From 1e29271fd9a5f1a2b591b633ecd09a8ca8fa649f Mon Sep 17 00:00:00 2001 From: Kevin Sommer Date: Fri, 14 May 2021 21:47:27 +0200 Subject: [PATCH] Check if NUGET_API_KEY can be accessed --- .github/workflows/ci_publish.yml | 2 ++ .nuke/build.schema.json | 3 +++ build/Build.cs | 8 +++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci_publish.yml b/.github/workflows/ci_publish.yml index 4b67598..28404fd 100644 --- a/.github/workflows/ci_publish.yml +++ b/.github/workflows/ci_publish.yml @@ -30,3 +30,5 @@ jobs: - uses: actions/checkout@v1 - name: Run './build.cmd CiPublish' run: ./build.cmd CiPublish + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} diff --git a/.nuke/build.schema.json b/.nuke/build.schema.json index 8cbcf43..6c8135f 100644 --- a/.nuke/build.schema.json +++ b/.nuke/build.schema.json @@ -43,6 +43,9 @@ "type": "boolean", "description": "Disables displaying the NUKE logo" }, + "NUGET_API_KEY": { + "type": "string" + }, "Plan": { "type": "boolean", "description": "Shows the execution plan (HTML)" diff --git a/build/Build.cs b/build/Build.cs index 5296b5f..6a21131 100644 --- a/build/Build.cs +++ b/build/Build.cs @@ -1,4 +1,5 @@ using System.Linq; +using Colorful; using Nuke.Common; using Nuke.Common.CI; using Nuke.Common.CI.GitHubActions; @@ -22,7 +23,8 @@ using static Nuke.Common.Tools.DotNet.DotNetTasks; OnPushBranches = new[] {"master", "releases/*"}, AutoGenerate = true, InvokedTargets = new[] {nameof(CiPublish)}, - CacheKeyFiles = new string[0])] + CacheKeyFiles = new string[0], + ImportSecrets = new[] {"NUGET_API_KEY"})] class Build : NukeBuild { [Parameter("Configuration to build - Default is 'Debug' (local) or 'Release' (server)")] @@ -34,6 +36,9 @@ class Build : NukeBuild [Solution] readonly Solution Solution; + // ReSharper disable once InconsistentNaming + [Parameter] string NUGET_API_KEY; + Project SieveProject => Solution.AllProjects.First(p => p.Name == "Sieve"); AbsolutePath OutputDirectory => RootDirectory / "output"; @@ -91,6 +96,7 @@ class Build : NukeBuild .DependsOn(Package) .Executes(() => { + Console.WriteLine(string.IsNullOrEmpty(NUGET_API_KEY)); }); Target Ci => _ => _