Skip to content

Commit

Permalink
GithubCI: add conditions for "Push" step
Browse files Browse the repository at this point in the history
Check for presence of secrets.NUGET_API_KEY is made in script
itself, because Github actions don't have access to secrets
context in if statements (see [1]).

[1] https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
  • Loading branch information
webwarrior-ws committed Apr 2, 2024
1 parent c7cafe0 commit c5146b5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ jobs:
--property:Version=$VERSION
- name: Push
if: github.event_name == 'push' && github.ref == 'refs/heads/upstream'
run: |
cd dist
dotnet nuget push *.nupkg --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json
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

0 comments on commit c5146b5

Please sign in to comment.