Write your first GitHub action - Part 3
September 01, 2019 by Anuraj
CI GitHub Actions ASPNET Core
In the last post we learned about deploying a NuGet package to nuget.org using dotnet nuget push
command. In this post, we will learn how to deploy an ASP.NET Core Web API application to Azure App Service.
For deploying web apps to Azure App services, Microsoft introduced an Action, we can get it from App Service actions repository. If we open the Action.yml
file, you will be able to see, it requires 3 parameters - publish-profile - app service publish settings file, app-name and package to deploy. Since publish settings file contains sensitive information, we need to use the GitHub secrets feature. Adding publish settings file to GitHub secrets is straight forward. Open the publish settings file, copy the contents to the GitHub secrets value textbox.
Next we need to modify the our action and include few steps to publish the code and deploy code to Azure. I am using dotnet publish
command to publish the project and for deploying I am using Azure App service action from Microsoft. You can use it like following.
And here is the final workflow.
It is a todo API application with Open API and Unit Tests. Here is the screenshot of deployment step.
In this post we updated our build script and included steps to deploy the ASP.NET Core Web API application to Azure.
Bonus Tip
You can include the build status badge using the following code.
![badge](https://action-badges.now.sh/anuraj/todo)
You can update the README.md file with the above code, which will display the build action badge for your repository, you can find more details about this feature here
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