Posted by Anuraj on Sunday, August 25, 2019 Reading time :1 minute
In the last post we learned about working with GitHub actions and creating a CI workflow for our dotnet core application. In this post, we will learn how to deploy the middleware to nuget.org using
dotnet nuget push command.
dotnet pack command helps you to create nuget package from our dotnet core applications. So first we need to add one more step in the action for building the nuget package and another step to deploy it to nuget.org. If you don’t have account in nuget.org, you need to create an account, and we need to get API Key for deploying the package.
The API Key is required to deploy the package to nuget.org. The
dotnet nuget push command can be used like this.
dotnet nuget push <NUGET PACKAGE> -k <API KEY> -s https://api.nuget.org/v3/index.json
We can utilize the GitHub secrets features to store the API Key, so that the key won’t be exposed if it is in a public repository.
And you can access it in the script like this
Finally I have updated the Action with two more steps and the final YAML file will be like this.
Now commit the changes, and it will trigger the build and you will be able to see the package is deployed to NuGet.org.
Here is the screenshot from the deployment step.
In this post we updated our build script and included steps to deploy the package using
dotnet nuget push command. In the next part, we will explore how to build, test and deploy an ASP.NET Core API app to Azure using GitHub actions.
Happy Programming :)
What do you think? I would like to hear your thoughts, suggestions, and questions in the comments section below.