Skip to content

Commit 9c43fd6

Browse files
Merge pull request #32 from TimeWarpEngineering/Cramer/2026-06-30/dev
fix(ci): NuGet API key fallback when OIDC trust policy missing
2 parents e13df5c + 677a388 commit 9c43fd6

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

.github/workflows/workflow.yml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,38 @@ jobs:
4242
- uses: actions/setup-dotnet@v4
4343
with:
4444
dotnet-version: '10.0.x'
45+
46+
# Prefer NuGet Trusted Publishing (OIDC). Fall back to org API key when no trust
47+
# policy exists yet for this package (common on first release under a new policy).
4548
- name: NuGet login (OIDC Trusted Publishing)
4649
if: github.event_name == 'release'
4750
id: nuget-login
51+
continue-on-error: true
4852
uses: nuget/login@v1
4953
with:
5054
user: TimeWarp.Enterprises
55+
5156
- name: Run CI Pipeline
57+
env:
58+
# OIDC key if login succeeded; otherwise org secrets (either name used historically)
59+
NUGET_API_KEY_OIDC: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
60+
NUGET_API_KEY_SECRET: ${{ secrets.PUBLISH_TO_NUGET_ORG || secrets.NUGET_API_KEY }}
5261
run: |
5362
if [ "${{ github.event_name }}" == "release" ]; then
54-
dotnet run --file tools/dev-cli/dev.cs -- workflow --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}"
63+
API_KEY="${NUGET_API_KEY_OIDC:-}"
64+
if [ -z "$API_KEY" ]; then
65+
echo "OIDC Trusted Publishing unavailable; using org NuGet API key secret."
66+
API_KEY="${NUGET_API_KEY_SECRET:-}"
67+
fi
68+
if [ -z "$API_KEY" ]; then
69+
echo "::error::No NuGet API key from OIDC or secrets.PUBLISH_TO_NUGET_ORG / NUGET_API_KEY."
70+
exit 1
71+
fi
72+
dotnet run --file tools/dev-cli/dev.cs -- workflow --api-key "$API_KEY"
5573
else
5674
dotnet run --file tools/dev-cli/dev.cs -- workflow
5775
fi
76+
5877
- name: Upload Artifacts
5978
if: always()
6079
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)