GitHub Actions makes it extremely easy for CI/CD to build, test, and deploy your code right from GitHub Repos. Github Actions Workflow has a robust integration with Microsoft Visual Studio. You can publish solutions using Github Action directly from Visual Studio just by following few steps. If you have your project in a GitHub repository and want to deploy the Azure solution, You can enable the CI/CD using the GitHub Actions workflow. Once the workflow is configured, Push it triggers and CI/CD for the targeted environments executed automatically with all Code. This post lets us learn how we can publish a solution directly from Visual Studio using Github Actions.
CI/CD using GitHub Actions Workflow
Firstly, ensure you have ensured the Preview Feature for “GitHub Action Support in Publish” is enabled. The Preview Features Page is available under Tools > Options > Environment > Preview Features.
Once this feature is enabled, From the Visual Studio, open the solution from GitHub for the deployment. Right Click on Solution and Click on Publish
With that, Publish Option will bring the Publish Wizard for Visual Studio, Where we need to select for Target Environment, Platform Services, Resources, and Other Options.
Let us choose the “Azure” as the target environment and select one Azure App Service for the Deployment. You can create an App Service directly from this Tooling Support or create one from Azure Portal and Map it here.
Once the Target and App Service is selected, moved to the “Deployment Type.” In this section, you must ensure to select “CI/CD using GitHub Actions Workflows.” This takes care of Integrating Publishing with GitHub Action and Generates the yml for build and deployment.
Finally, Click on Finish. It’s done. Visual Studio will take care of the rest of the thing. It will create all the necessary files for GitHub Action, for Build and Release. If you open your GitHub Repository and Move to the Action Tab, you will find the Build details and execution steps.
Moreover, after Workflow is completed successfully, Visual Studio Publish Wizard displays the status of the Workflow. In Addition, from this screen, you can select “Show Commit details” which will take you to the GitHub Action Tab.
View All Workflows
Finally, To view all the workflows, navigate to your GitHub Repository and move to Actions Tab. It will display all run workflow. After that, you can select each of them and dig dive to see what has been executed.
To Summarize, CI/CD using GitHub Actions can be easily established directly from Visual Studio by following few steps.
- Firstly, Ensure to have the “GitHub Actions Support in Publish” is enabled.
- Secondly, Open the Solution from GitHub Repository and Select Publish
- Thirdly, From the Publish Wizard, select Target and Deployment Services
- Finally, Choose Deployment Types as “CI/CD using GitHub Actions Workflows.”