You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The CI/CD release workflow fails at the "Push to NuGet" step with a 401 Unauthorized error. Initial diagnosis incorrectly assumed NuGet Trusted Publishing wasn't configured - it was. The real issue was that the `nuget/login@v1` action outputs the API key but doesn't automatically make it available to `dotnet nuget push`. The key must be explicitly passed.
6
+
7
+
## Checklist
8
+
9
+
-[x] Investigate CI failure - found 401 error on push
10
+
-[x] Verify NuGet Trusted Publishing is configured (it was already correct)
11
+
-[x] Discover that `nuget/login@v1` only sets output, not environment variable
12
+
-[x] Confirm blog post claiming "no API key needed" is misleading (author's own repo passes it explicitly)
13
+
-[x] Add `--api-key` option to `ci-command.cs`
14
+
-[x] Update `PushPackagesAsync` to use the API key
15
+
-[x] Update `ci-cd.yml` to pass the API key from `nuget-login` step output
16
+
-[x] Verify build succeeds
17
+
-[ ] Create PR and verify release workflow works
18
+
19
+
## Notes
20
+
21
+
### Root Cause
22
+
The `nuget/login@v1` action only does `core.setOutput('NUGET_API_KEY', apiKey)` - it does NOT:
23
+
- Set an environment variable
24
+
- Write to a NuGet config file
25
+
- Make the key automatically available to subsequent `dotnet` commands
26
+
27
+
### The Misleading Blog Post
28
+
Gerald Versluis (Microsoft employee) wrote https://blog.verslu.is/nuget/trusted-publishing-easy-setup/ which claims:
29
+
> "You don't need to explicitly pass the API key anymore. It's automatically used by the subsequent dotnet commands."
30
+
31
+
But his actual workflow at https://github.com/jfversluis/maui-version/blob/main/.github/workflows/release.yml**does** pass the key explicitly:
Copy file name to clipboardExpand all lines: source/timewarp-terminal/timewarp-terminal.csproj
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
<PropertyGroup>
4
4
<!-- Independent versioning - not tied to Nuru version -->
5
-
<Version>1.0.0-beta.3</Version>
5
+
<Version>1.0.0-beta.2</Version>
6
6
<AssemblyName>TimeWarp.Terminal</AssemblyName>
7
7
<RootNamespace>TimeWarp.Terminal</RootNamespace>
8
8
<Description>Terminal abstractions and widgets for console applications - IConsole, ITerminal, panels, tables, rules, and ANSI color support</Description>
Copy file name to clipboardExpand all lines: tools/dev-cli/generated/TimeWarp.Nuru.Analyzers/TimeWarp.Nuru.NuruAttributedRouteGenerator/GeneratedAttributedRoutes.g.cs
+2-1Lines changed: 2 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -29,9 +29,10 @@ internal static class GeneratedAttributedRoutes
.WithOption("mode",shortForm:"m",parameterName:"mode",expectsValue:true,parameterType:"string",parameterIsOptional:true,description:"CI mode: pr, merge, or release (auto-detected from GITHUB_EVENT_NAME if not specified)",isOptionalFlag:true)
32
+
.WithOption("api-key",shortForm:"k",parameterName:"apiKey",expectsValue:true,parameterType:"string",parameterIsOptional:true,description:"NuGet API key for publishing (required for release mode)",isOptionalFlag:true)
0 commit comments