AZ-400: Designing and Implementing Microsoft DevOps Solutions
Configure Activity Traceability and Flow of Work
Demo Generating Release Notes
In this guide, you'll learn how to automatically generate release notes and integrate them into your Azure DevOps Wiki. Although there are various methods available—such as sending release notes via email or saving them to Azure Storage—we will focus on embedding this functionality into an Azure DevOps pipeline for a streamlined workflow.
Overview
For this example, we have an Azure DevOps project already set up. The project repository includes a code-based Wiki, which enables automatic updates whenever new release notes are generated. This strategy allows developers to easily track what changes have been introduced with each release.
Prerequisites
Install the Release Notes Plugin:
Start by installing the "Generate Release Notes Cross-Platform" plugin from the Visual Studio Marketplace. Developed by Richard Fennell, this extension simplifies the creation of Markdown release notes.Plugin Installation Note
Click the "Get it Free" button to install the extension for your organization. For on-premises Azure DevOps servers, it is also available for download.
- Prepare Your Pipeline:
Before configuring your release notes generation, ensure that your pipeline is connected and an appropriate agent pool is available—even if your pipeline setup is still in progress.
Creating a New Pipeline
To begin, navigate to the Azure DevOps Portal and create a new pipeline:
- Select Pipelines and click Create Pipeline.
- Choose your repository (for instance, Azure Repos under the "TestWeb" project).
- Configure your pipeline using a starter template.
Below is an initial example of a starter YAML pipeline configuration:
# Starter-pipeline
# Begin with a minimal pipeline that you can later customize to build and deploy your code.
trigger:
- master
pool:
vmImage: ubuntu-latest
steps:
- script: echo Hello, world!
displayName: 'Run a one-line script'
- script: |
echo Add tasks to build, test, and deploy your project.
echo See https://aka.ms/yaml
displayName: 'Run a multi-line script'
Configuring the Pipeline for a .NET Project
For a .NET project, adjust the pipeline to use the Windows environment and include build, restore, test, and build tasks. Below is an example configuration:
# Starter-pipeline for a .NET Project
trigger:
- master
pool:
vmImage: 'windows-latest'
name: 'KodeKloudCustomer'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '1.0.x'
installationPath: $(Agent.ToolsDirectory)/dotnet
- script: dotnet --version
displayName: 'Check .NET Version'
- script: dotnet restore
displayName: 'Restore dependencies'
- script: dotnet build --configuration Release --no-restore
displayName: 'Build project'
- script: dotnet test --no-build --verbosity normal
displayName: 'Run tests'
Integrating the Release Notes Generation Plugin
After confirming that your .NET application builds successfully, it's time to incorporate the release notes generation into your pipeline.
Adding the Release Notes Generation Task
The task below uses the plugin to generate release notes in a local folder. Notice that the output filename includes the build ID, which ensures each release notes file is unique. The inline template, written in Handlebars syntax, includes key build details.
- task: XplatGenerateReleaseNotes@4
inputs:
outputFile: '$(Build.Repo.RootPath)\releasenotes_$(Build.BuildId).md'
templateLocation: 'Inline'
inlineTemplate: |
## Build {{buildDetails.buildNumber}}
**Branch:** {{buildDetails.sourceBranch}}
**Requested for:** {{buildDetails.requestedFor.displayName}}
**Source Version:** {{buildDetails.sourceVersion}}
dumpPayloadToConsole: false
includeParentsAndChildren: false
includeParentIssues: false
exportRequiredPipelines: false
includeSequentialJobs: false
Copying the Release Notes to the Wiki Folder
The next step is to copy the generated release notes into your wiki folder. This ensures that developers can quickly access build updates from the repository.
- task: CopyFiles@2
displayName: 'Copy Release Notes to Wiki Folder'
inputs:
SourceFolder: '$(Build.Repository.LocalPath)'
Contents: 'releasenotes_$(Build.BuildId).md'
TargetFolder: '$(Build.Repository.LocalPath)/wiki'
CleanTargetFolder: true
Overwrite: true
Cleaning Up Temporary Files
After copying the release notes, remove the original file from the working directory:
- script: |
del "$(Build.Repository.LocalPath)\releasenotes_$(Build.BuildId).md"
displayName: 'Delete Original Release Notes File'
Committing the Release Notes to the Wiki
Finally, commit the changes to the repository. The commit uses a message prefixed with "[skip ci]" to avoid triggering another pipeline run. The command-line task ensures the repository is on the master branch, configures Git user settings, and pushes the changes.
Important
Ensure that your commit message includes "[skip ci]" to prevent an infinite loop of pipeline executions.
- task: CmdLine@2
displayName: 'Commit Release Notes to Wiki Folder'
inputs:
script: |
git checkout master
git pull
git config --global user.email "[email protected]"
git config --global user.name "Jeremy Morgan"
git remote add origin https://[email protected]/jeremy6065/TestWeb/_git/TestWeb
git add
git commit -m "[skip ci] Update release notes in wiki folder"
git push origin HEAD:master
Full Pipeline Configuration
Below is a complete example that integrates the .NET build tasks with release notes generation, file copying, and committing the release notes to your Azure DevOps Wiki.
trigger:
- master
pool:
vmImage: 'windows-latest'
name: 'KodeKloudCustomer'
steps:
- task: UseDotNet@2
inputs:
packageType: 'sdk'
version: '8.0.x'
installationPath: '$(Agent.ToolsDirectory)/dotnet'
- script: dotnet --version
displayName: 'Check .NET Version'
- script: dotnet restore
displayName: 'Restore dependencies'
- script: dotnet build --configuration Release --no-restore
displayName: 'Build project'
- script: dotnet test --no-build --verbosity normal
displayName: 'Run tests'
- task: XplatGenerateReleaseNotes@4
inputs:
outputFile: '$(Build.Repository.LocalPath)\releasenotes_$(Build.BuildId).md'
templateLocation: 'Inline'
inlineTemplate: |
## Build {{buildDetails.buildNumber}}
**Branch:** {{buildDetails.sourceBranch}}
**Author:** {{buildDetails.requestedFor.displayName}}
**Commit:** {{buildDetails.sourceVersion}}
dumpPayloadToConsole: false
dumpPayloadToFile: true
getParentsAndChildren: false
getAllParents: false
getIndirectPullRequests: false
stopOnError: false
considerPartiallySuccessfulReleases: false
checkForManuallyLinkedWI: false
wiqlFromTarget: 'WorkItems'
- task: CopyFiles@2
displayName: 'Copy Release Notes to Wiki Folder'
inputs:
SourceFolder: '$(Build.Repository.LocalPath)'
Contents: 'releasenotes_$(Build.BuildId).md'
TargetFolder: '$(Build.Repository.LocalPath)/wiki'
CleanTargetFolder: true
Overwrite: true
- script: |
del "$(Build.Repository.LocalPath)\releasenotes_$(Build.BuildId).md"
displayName: 'Delete Original Release Notes File'
- task: CmdLine@2
displayName: 'Commit Release Notes to Wiki Folder'
inputs:
script: |
git checkout master
git pull
git config --global user.email "[email protected]"
git config --global user.name "Jeremy Morgan"
git remote add origin https://[email protected]/jeremy6065/TestWeb/_git/TestWeb
git add
git commit -m "[skip ci] Update release notes in wiki folder"
git push origin HEAD:master
Monitoring Pipeline Execution
After committing the changes, your pipeline triggers a new build. You can monitor each stage via the Azure DevOps pipeline interface:
Build Summary:
Verify the build status and review any summaries.Repository Changes:
Confirm that the release notes file has been copied to the Wiki folder.Task Logs:
Review the logs for the release notes generation task to ensure it executed successfully.
Once the commit task completes, the release notes will appear in your Wiki folder with a filename like releasenotes_1216.md. The file includes the build number, branch, author, and commit details—information that can be further extended to include bug fixes, linked work items, or comprehensive release summaries.
Conclusion
This article demonstrated how to set up an automated process to generate and publish release notes for your .NET application using an Azure DevOps pipeline. The process involves:
- Building and testing your application.
- Generating release notes using an inline Handlebars template.
- Copying the release notes to a designated Wiki folder.
- Committing the changes without triggering an endless build loop.
Thank you for reading, and happy coding!
Watch Video
Watch video content