Skip to content

Commit c4efe31

Browse files
ANcpLuaclaude
andcommitted
fix: add OIDC token authentication for NuGet Trusted Publishing
- Request OIDC token from GitHub Actions - Pass token as API key to dotnet nuget push - This enables Trusted Publishing without storing secrets 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 21b1c29 commit c4efe31

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.github/workflows/nuget-publish.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ jobs:
4444

4545
- name: Publish packages to NuGet.org
4646
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
47+
env:
48+
NUGET_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4749
run: |
50+
# Request OIDC token for NuGet Trusted Publishing
51+
OIDC_TOKEN=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" | jq -r '.value')
52+
53+
# Push package with OIDC token
4854
dotnet nuget push ./nupkg/*.nupkg \
4955
--source https://api.nuget.org/v3/index.json \
56+
--api-key "$OIDC_TOKEN" \
5057
--skip-duplicate

SWEN3.Paperless.RabbitMq/RabbitMqExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace SWEN3.Paperless.RabbitMq;
1212
/// <summary>
1313
/// <para>Use <see cref="PublishingExtensions.PublishOcrCommandAsync{T}" /> to publish OCR commands.</para>
1414
/// <para>Use <see cref="PublishingExtensions.PublishOcrEventAsync{T}" /> to publish OCR events.</para>
15+
/// <para>Use <see cref="GenAIPublishingExtensions.PublishGenAICommandAsync{T}" /> to publish GenAI commands (e.g., summaries).</para>
1516
/// <para>Use <see cref="GenAIPublishingExtensions.PublishGenAIEventAsync{T}" /> to publish GenAI events.</para>
1617
/// <para>Use <see cref="IRabbitMqConsumerFactory.CreateConsumerAsync{T}" /> to create message consumers.</para>
1718
/// <para>Use <see cref="PaperlessEndpointExtensions.MapOcrEventStream" /> to map OCR SSE endpoint.</para>

0 commit comments

Comments
 (0)