C# / .NETDevOpsMisc
C# / .NET
Publishing release notes to TFS/VSTS Wiki during Release
Alexandru Puiu
Alexandru Puiu
August 20, 2018
1 min

As part of our process we create PBIs (work items) describing what needs to be done, and then during commit, our commit messages describe what we actually changed. During a release we need to keep track of this information and inform stakeholders as to what changed. This used to be fairly time-consuming step in which we had to gather information from the PBIs and commit messages and write up what we’re releasing. We managed to automate it to the point where all the information is linked cleanly into one page per release, with each work item linked directly, which allows someone to quickly get additional context.

release notes wiki2

Install the Generate Release Notes Build Task from the Azure DevOps Marketplace

https://marketplace.visualstudio.com/items?itemName=richardfennellBM.BM-VSTS-GenerateReleaseNotes-Task

In the release, add an Agent phase (if you don’t already have one)

Add the Generate Release Notes Task and a PowerShell Task

release notes

Customize the release notes properties and template as needed

release notes task

Since the Wiki already links work items by IDs, I found it useful to only include the IDs in the template.

**Build Number**  : $($build.buildnumber)    
**Build started** : $("{0:dd/MM/yy HH:mm:ss}" -f [datetime]$build.startTime)     
**Source Branch** : $($build.sourceBranch)  

###Associated work items  
@@WILOOP@@  
* #$($widetail.id)
@@WILOOP@@  

###Associated change sets/commits  
@@CSLOOP@@  
* **ID $($csdetail.changesetid)$($csdetail.commitid)** 
  >$($csdetail.comment)    
@@CSLOOP@@

Now that the release notes have been written to a file, you can do whatever else you want with it, such as post-processing, emailing somewhere, etc. Next we’ll post it to our Wiki using PowerShell

$content = [IO.File]::ReadAllText("$(System.DefaultWorkingDirectory)\releasenotes.md")
$data = @{content=$content;} | ConvertTo-Json;
$params = @{uri = '$(WikiPath)';
  Method = 'PUT';
  Headers = @{Authorization = "Bearer $(System.AccessToken)" };
  ContentType = "application/json";
  Body = $data;
}
Invoke-WebRequest @params

Next, we need to add the Variable we referenced:


Tags

utils
Alexandru Puiu

Alexandru Puiu

Engineer / Security Architect

Systems Engineering advocate, Software Engineer, Security Architect / Researcher, SQL/NoSQL DBA, and Certified Scrum Master with a passion for Distributed Systems, AI and IoT..

Expertise

.NET
RavenDB
Kubernetes

Social Media

githubtwitterwebsite

Related Posts

RavenDB Integration Testing
Using RavenDB in Integration Testing
December 24, 2022
2 min

Subscribe To My Newsletter

I'll only send worthwhile content I think you'll want, less than once a month, and promise to never spam or sell your information!
© 2023, All Rights Reserved.

Quick Links

Get In TouchAbout Me

Social Media