From e5ec9b45f3e089b7729fe9cad450440ea85e59b8 Mon Sep 17 00:00:00 2001 From: Dexter Ajoku Date: Thu, 2 Apr 2026 05:13:09 +0200 Subject: [PATCH] Guard NuGet push when API key is missing --- .github/workflows/release.yml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c23189a..2cc2b2d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,10 +82,23 @@ jobs: -p:PackageVersion=${{ steps.vars.outputs.version }} -o artifacts/packages + - name: Validate NuGet API key + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + shell: bash + run: | + if [[ -z "${NUGET_API_KEY}" ]]; then + echo "NUGET_API_KEY secret is missing or empty." + echo "Set repository secret NUGET_API_KEY before running release workflow." + exit 1 + fi + - name: Push package to NuGet + env: + NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} run: > dotnet nuget push artifacts/packages/*.nupkg - --api-key ${{ secrets.NUGET_API_KEY }} + --api-key "${NUGET_API_KEY}" --source https://api.nuget.org/v3/index.json --skip-duplicate