Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ jobs:
windows-latest:
name: windows-latest
runs-on: windows-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7
with:
Expand All @@ -41,11 +44,16 @@ jobs:
.nuke/temp
~/.nuget/packages
key: ${{ runner.os }}-${{ hashFiles('**/global.json', '**/*.csproj') }}
- name: NuGet login (OIDC)
id: nuget-login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }}
- name: Run './build.cmd Verify Cover Publish'
run: ./build.cmd Verify Cover Publish --no-logo
env:
GitHubToken: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
- uses: actions/upload-artifact@v7
with:
name: testresults
Expand Down
6 changes: 4 additions & 2 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
PublishArtifacts = true,
InvokedTargets = [nameof(Verify), nameof(Cover), nameof(Publish)],
EnableGitHubToken = true,
ImportSecrets = [Secrets.NuGetApiKey])]
ImportSecrets = [Secrets.NuGetUser])]
class Build : NukeBuild
{
public static int Main() => Execute<Build>(x => x.Compile);
Expand All @@ -54,7 +54,8 @@ class Build : NukeBuild
[Parameter("GitHub auth token", Name = "github-token"), Secret] readonly string GitHubToken;
[Parameter("Forces the continuous integration build flag")] readonly bool CI;

[Secret][Parameter("NuGet API Key (secret)", Name = Secrets.NuGetApiKey)] readonly string NuGetApiKey;
// On CI this is the short-lived key from NuGet/login (OIDC). Locally you can still pass a classic API key.
[Secret][Parameter("NuGet API Key", Name = Secrets.NuGetApiKey)] readonly string NuGetApiKey;
readonly string NuGetSource = "https://api.nuget.org/v3/index.json";

IEnumerable<Project> Excluded =>
Expand Down Expand Up @@ -203,5 +204,6 @@ class Build : NukeBuild
public static class Secrets
{
public const string NuGetApiKey = "NUGET_API_KEY";
public const string NuGetUser = "NUGET_USER";
}
}