Search code examples
azure-devopsmarkdownwikiazure-pipelines-release-pipeline

Publishing release notes as part of a VSTS realise definition


I have release definition that publishes a web app and database. As part pic that definition I am generating release notes into a .md file and manually uploading them to the projects wiki page on VSTS. I was wondering if there was a way to add a task to the release definition to automate the publishing of the release notes to the wiki.


Solution

  • Since each team project wiki employs a git repository backend, you can clone that wiki repository and add or edit pages, then commit and push changes.

    Clone and update wiki pages offline

    The simple way:

    1. Check Allow scripts to access OAuth token option in the Phase of build
    2. Add Command Line task (Tool: git; Arguments: clone https://test:$(System.AccessToken)@xxx.visualstudio.com/xxxx mywiki; Working folder: $(build.sourcesdirectory))
    3. Add tasks to add or modify pages
    4. Command Line task (Tool: git; Arguments: config --global user.email "[email protected]"; Working folder: $(build.sourcesdirectory)\mywiki)
    5. Command Line task (Tool: git; Arguments: config --global user.name "tester"; Working folder: $(build.sourcesdirectory)\mywiki)
    6. Command Line task (Tool: git; Aguments: add *; Working folder: $(build.sourcesdirectory)\mywiki)
    7. Command Line task (Tool: git; Aguments: commit -m "update wikipage"; Working folder: $(build.sourcesdirectory)\mywiki)
    8. Command Line task (Tool: git; Aguments: push https://test:$(System.AccessToken)@xx.visualstudio.com/xxx; Working folder: $(build.sourcesdirectory)\mywiki)

    You can put the commands of step 3 ~ 7 in a file (e.g. bat, ps1), then just add a task and specify the file.

    Note: The Project Collection Build Service account needs Contribute permission (Version Control admin page and set permission for Git repositories)