Skip to content

Commit 4fe8885

Browse files
committed
fix: use NuGet login for trusted publishing
1 parent dd73e3a commit 4fe8885

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/nuget-publish.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,16 @@ jobs:
4242
- name: Pack NuGet package
4343
run: dotnet pack SWEN3.Paperless.RabbitMq/SWEN3.Paperless.RabbitMq.csproj --configuration Release --no-build --output ./nupkg -p:GeneratePackageOnBuild=false
4444

45+
- name: NuGet login (OIDC → temp API key)
46+
uses: NuGet/login@v1
47+
id: login
48+
4549
- name: Publish packages to NuGet.org (Trusted Publishing)
4650
if: github.event_name == 'release' || github.event_name == 'workflow_dispatch'
51+
env:
52+
NUGET_AUTH_TOKEN: ${{ steps.login.outputs.NUGET_AUTH_TOKEN }}
4753
run: |
48-
# Request OIDC token for NuGet Trusted Publishing
49-
OIDC_TOKEN=$(curl -sS -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
50-
"$ACTIONS_ID_TOKEN_REQUEST_URL&audience=api://AzureADTokenExchange" | jq -r '.value')
51-
5254
dotnet nuget push ./nupkg/*.nupkg \
5355
--source https://api.nuget.org/v3/index.json \
54-
--api-key "$OIDC_TOKEN" \
56+
--api-key "$NUGET_AUTH_TOKEN" \
5557
--skip-duplicate

0 commit comments

Comments
 (0)