In this post, I’m going to explain how to create a pipeline and a release in Azure DevOps that releases into AppServices. This is quite important step to go forward a digital transformation in your company to improve and optimize the developer’s process.
In the pipeline
Azure DevOps builds the solution (projects and tests) and create an artifact
. Then, with the release
, it publishes the artifact
into to a AppService in Azure. Now I show step by step how to create both.
Table of contents
Pipeline
First, you have to create a New pipeline and then select where your code is. If you select one of the elements in the list, Azure DevOps will create an YAML
file. This wizard is not suitable for me; then I want to “Use the classic editor
”
After this choice, I have to select my repository. My repository is in Azure Repos Git
and then some fields are already prepopulated.
In this step I have to select:
- Team project
- Repository
- Default branch for manual and scheduled builds
If you want to implement Git Flow branches for your deployment, please read the post I created about it.
Then, I have to choose a template: I search and add ASP.NET Core
. Now, I have to add 4 steps before publishing the artifact.
dotnet restore
Restore the Nuget packages for the solution. In the Path to project(s)
I explicitly say what project I want to build.
**/MyProject.csproj
**/MyProject.Tests.csproj
dotnet test
Run the tests for the solution, if there are exists.
dotnet build
This step is building all projects. Add in Path to project(s)
:
**/*.csproj
dotnet publish
Publish the compiled project(s) in a zip file in a particular directory, so, I can read it later. For that, add in Arguments
this text:
-o $(Build.ArtifactStagingDirectory)
Publish Artifact: drop
Finally, I publish the artifact from a specific directory in Path to publish
:
$(Build.ArtifactStagingDirectory)
Also, check:
- Publish web projects
- Zip published projects
Release
The release takes the artifact and publish it in an Azure AppService
. First, select from where it has to take the artifact and remember to enable the continuous deployment.
Change the Package or folder
in $(System.DefaultWorkingDirectory)/*/.zip
Conclusion
So, in this short post I explained how to create a process in Azure DevOps to release AppServices.
2 thoughts on “Azure DevOps releases AppServices”