Write your first GitHub action - Part 2
August 25, 2019 by Anuraj
CI GitHub Actions ASPNET Core
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.
The 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 :)
Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub