Skip to content

GitHub Actions: automatically push NuGet package #26906

Discussion options

You must be logged in to vote

Hi @PieterjanDeClippel,

Instead of using, dotnet nuget add source, you can use the setup-dotnet to create the appropriate nuget.config file. For example"

    - uses: actions/setup-dotnet@v1.5.0
      with:
        dotnet-version: '3.1.x' # SDK Version to use.
        source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
      env:
        NUGET_AUTH_TOKEN: '%NUGET_AUTH_TOKEN%'
- name: Publish the package to GPR
  run: dotnet nuget push path/to/*.nupkg
  env:
    NUGET_AUTH_TOKEN: ${{ github.token }}

This should work to associate your package with the same repository as the workflow. You only need to create a PAT if you’re associating it with a different repo…

Replies: 12 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@PieterjanDeClippel
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Actions Build, test, and automate your deployment pipeline with world-class CI/CD Packages Host your dependencies, libraries, and production-ready code, right from your repository Product Feedback
3 participants