Publish Nuget #3945
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Nuget | |
on: | |
push: | |
branches: | |
- master | |
workflow_run: | |
workflows: ['ci'] | |
types: | |
- completed | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Dump GitHub context | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: echo "$GITHUB_CONTEXT" | |
- uses: nuget/setup-nuget@v1 | |
with: | |
nuget-version: '5.x' | |
- name: Download artifact | |
uses: dawidd6/action-download-artifact@v3 | |
if: github.event.workflow_run.conclusion == 'success' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: ci.yml | |
run_id: ${{ github.event.id }} | |
name: nuget | |
- name: nuget.org | |
# continue-on-error: true | |
if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main') && startsWith(github.event.workflow_run.head_branch, 'v') # this is the best approximation for a tag | |
env: | |
ApiKey: ${{ secrets.RSG_NUGET_API_KEY }} | |
shell: pwsh | |
run: | | |
dotnet nuget push **/*.nupkg --skip-duplicate -s nuget.org --api-key $ENV:ApiKey |