Automatically embed release notes in your canvas app

I’ve been talking about Power Apps (canvas) co-authoring feature in European Power Platform Conference 2022 at Berlin and in Scottish Summit 2022 in Glasgow. The recording of the latter can be found below.

In both sessions I was asked to share the implementation of the DevOps pipeline I demonstrated to automate embedding of release notes from DevOps wiki into a separate screen of the canvas app.

Maker experience

This is how it work from maker’s perspective (or whoever is in charge of build and releases in your specific project).

In my demo app I have a separate screen called scrReleaseNotes. The user can access the screen via a small grayed icon next to the build version number.

In the development environment the screen does not (and should not) contain any actual release notes information – it merely contains placeholders that the build pipeline will populate when the app is deployed to the test environment.

RELEASE_COMMENT will be replaced with the comment text that is provided when the build is manually started.

RELEASE_NOTES_PLACEHOLDER will be replace with the text from a specific Wiki page from Azure DevOps.

After the DevOps pipeline is run the scrReleaseNotes will look like below.

DevOps pipeline

The DevOps pipeline has the following steps in it.

  1. Call a script to update release comments
    This step will embed the text provided when starting the build into the screen title. In the demonstration image above this is “Release notes in SS2022 demo”. The script modifies app’s source code files directly
  2. Call a script to update release notes
    This step will read the contents of the Wiki page, make some simple conversion from markdown into HTML and embed the HTML into the release notes screen. The script modifies app’s source code files directly
  3. Install Power Platform Build Tools and do some connectivity tests
  4. Install Microsoft Power Platform CLI on the build agent
  5. Update version number of the app in the development environment
    Pattern: 1.0.yyyyMMdd.N (N being daily incrementing build number)
  6. Extract solution from the development environment
  7. Unpack extracted solution
  8. Pack canvas app from source files into msapp file
    The target path of the operation resides within the extracted solution’s folder structure
  9. Pack the solution
  10. Import and upgrade the solution into the target environment

The entire pipeline YAML:

parameters:
- name: releaseNotes
  displayName: Release notes
  type: string

trigger: none

pool:
  vmImage: windows-latest

variables:
  packageVersion: '1.0.$(Build.BuildNumber)'

steps:

- checkout: self
  persistCredentials: true

- task: PowerShell@2
  inputs:
    filePath: '.\Scripts\set-release-notes.ps1'
    arguments: "'${{ parameters.releaseNotes }}'"
  displayName: Update release comments
  
- task: PowerShell@2
  inputs:
    filePath: '.\Scripts\set-release-notes-v2.ps1'
  displayName: Update release notes from wiki

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      Get-Content -Path '.\Git Demo App Source\Src\scrReleaseNotes.fx.yaml'
  displayName: Write release notes page
  
- task: PowerPlatformToolInstaller@0
  inputs:
    DefaultVersion: true
  displayName: Install Power Platform Build Tools

- task: PowerPlatformWhoAmi@0
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'EPPC22'
  displayName: Test connection to DEV

- task: PowerPlatformWhoAmi@0
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'EPPC22-Test'
  displayName: Test connection to TEST

- task: NuGetCommand@2
  inputs:
    command: 'custom'
    arguments: 'install Microsoft.PowerApps.CLI -OutputDirectory paccli'
  displayName: Install pac CLI

- task: PowerPlatformSetSolutionVersion@0
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'EPPC22'
    SolutionName: 'GitVersionControlDemo'
    SolutionVersionNumber: $(packageVersion)
  displayName: Update version number in dev environment

- task: PowerPlatformExportSolution@0
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'EPPC22'
    SolutionName: 'GitVersionControlDemo'
    SolutionOutputFile: 'GitVersionControlDemoSolution.zip'
  displayName: Extract solution from dev

- task: PowerPlatformUnpackSolution@0
  inputs:
    SolutionInputFile: 'GitVersionControlDemoSolution.zip'
    SolutionTargetFolder: 'GitVersionControlDemoSolution'
    AsyncOperation: true
    MaxAsyncWaitTime: '60'
  displayName: Unpack solution

- task: PowerShell@2
  inputs:
    targetType: 'inline'
    script: |
      # Go to pac folder and update PATH (https://benediktbergmann.eu/2021/08/06/execute-power-apps-cli-in-azure-devops/)
      $pacNugetFolder = Get-ChildItem "paccli" | Where-Object {$_.Name -match "Microsoft.PowerApps.CLI."}   
      $pacPath = $pacNugetFolder.FullName + "\tools"   
      # Set pac to PATH
      $env:PATH = $env:PATH + ";" + $pacPath
      pac canvas pack --sources 'Git Demo App Source' --msapp '.\GitVersionControlDemoSolution\CanvasApps\tan_gitdemoapp_15e06_DocumentUri.msapp'
  displayName: Pack msapp from source

- task: PowerPlatformPackSolution@0
  inputs:
    SolutionSourceFolder: '.\GitVersionControlDemoSolution'
    SolutionOutputFile: 'GitVersionControlDemoSolutionMod.zip'
  displayName: Pack solution

- task: PowerPlatformImportSolution@0
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'EPPC22-Test'
    SolutionInputFile: 'GitVersionControlDemoSolutionMod.zip'
    AsyncOperation: true
    MaxAsyncWaitTime: '60'
  displayName: Deploy solution to test

- task: PowerPlatformApplySolutionUpgrade@0
  inputs:
    authenticationType: 'PowerPlatformSPN'
    PowerPlatformSPN: 'EPPC22-Test'
    SolutionName: 'GitVersionControlDemo'
    AsyncOperation: true
    MaxAsyncWaitTime: '60'

set-release-notes.ps1:

Param($notes)
Write-Host "Release notes :`"" $notes "`""
$content = Get-Content -Raw -Path '.\Git Demo App Source\Src\scrReleaseNotes.fx.yaml'
$content = $content -replace "RELEASE_COMMENT", $notes
Set-Content -Path '.\Git Demo App Source\Src\scrReleaseNotes.fx.yaml' -Value $content

set-release-notes-v2.ps1:

$content = Get-Content -Raw -Path '.\Git Demo App Source\Src\scrReleaseNotes.fx.yaml'
$wikiContent = Get-Content -Path '.\Git-Demo-Release-Notes.md'
$wikiContent = $wikiContent -replace "(#.*)", "<h1>`$1</h1>" -replace "# ", "" -replace "<h1></h1>", ""
$content = $content -replace "RELEASE_NOTES_PLACEHOLDER", $wikiContent
Set-Content -Path '.\Git Demo App Source\Src\scrReleaseNotes.fx.yaml' -Value $content

Leave a Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s