Skip to content

Latest commit

 

History

History
86 lines (63 loc) · 5.33 KB

README.md

File metadata and controls

86 lines (63 loc) · 5.33 KB
page_type description products languages
dotnet core
Deploy .NET application using GitHub Actions
GitHub Actions
Azure App service
dotnet core

Sample ASP.NET Core application for GitHub Actions

For all samples to set up GitHub workflows, see [Create your first workflow](https://github.com/Azure/actions-workflow-samples

Steps to create an End-to-End CI/CD Workflow

Pre-requisites

  • Create a new Web App in Azure Portal with runtime stack as .NETCore and OS as Linux/Windows
  • Copy Publish Profile Settings of the app

Create an ASP.NET App Service in Azure

This template deploys a web app with ASP.NET support. The web app with ASP.NET is an app service that allows you to deploy your ASP.NET website. This will deploy a free tier Windows App Service Plan where you will host your App Service.

If you are new to Azure App Service, see:

Configure secrets in the GH repo:

  • In the GH repo with Application code, Define a new secret under repository by navigating to settings > secrets > Add a new secret
  • Paste the contents for the downloaded publish profile file into the secret's value field
  • Now in the workflow file in your branch: .github/workflows/workflow.yml replace the secret for the input publish-profile: of the deploy Azure WebApp action

test your workflow

  • Commit a change in the app code.
  • You should see a new GitHub Action initiated in Actions tab.
  • At the end of the execution, navigate to the App URL to visualise the change introduced.

Workflow YAML explained

  • Checkout Checks out your Git repository content into Github Actions agent.
  • Environment setup using Setup DotNet - Sets up a dotnet environment by optionally downloading and caching a version of dotnet by SDK version and adding to PATH .
  • DotNet Build & Publish
  • Deploy to App service using azure/webapps-deploy@v1 action which authenticates using Azure Web App Publish Profile which we configured using the secret set up at the repo level

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Legal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all others rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.