Skip to content

Latest commit

 

History

History
68 lines (51 loc) · 4.21 KB

README.md

File metadata and controls

68 lines (51 loc) · 4.21 KB
page_type description products languages
sample
Deploy dotnet application using GitHub Actions
GitHub Actions
Azure App service
dotnet

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 .NET and OS as 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 MSBuild - Sets up a ms-build 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.opensource.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., status check, 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 [email protected] with any additional questions or comments.