From a691a3d176b5ae2030bd8f23cbb47235a759adbc Mon Sep 17 00:00:00 2001 From: "Andres G. Aragoneses" Date: Thu, 11 Apr 2024 13:11:27 +0800 Subject: [PATCH] GitHubCI: rather check NUGET_API_KEY in GHActions' `if` --- .github/workflows/dotnet.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index b803ca828..38d4151e3 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -70,9 +70,10 @@ jobs: --property:Version=$VERSION - name: Push - if: github.event_name == 'push' && github.ref == 'refs/heads/upstream' + env: + NUGET_API_KEY: ${{secrets.NUGET_API_KEY}} + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/upstream' && env.NUGET_API_KEY != '' }} run: | cd dist - if [ -n "${{secrets.NUGET_API_KEY}}" ]; then - dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json - fi + dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json +