Created
October 3, 2021 19:47
-
-
Save DaveRuijter/c72cecb255cd52d73aeae0f67cd0ee1e to your computer and use it in GitHub Desktop.
Azure DevOps YAML pipeline for release administration, with automatic SemVer based on GitVersion and automatic release notes publication
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trigger: | |
| - main | |
| - master | |
| pool: | |
| vmImage: ubuntu-latest | |
| ## Job to create release and add tag | |
| jobs: | |
| - job: CalculateVersion | |
| displayName: Tagging release version | |
| steps: | |
| # Checkout with persist credentials | |
| - checkout: self | |
| persistCredentials: true | |
| # Install GitVersion | |
| - task: gitversion/setup@0 | |
| displayName: Install GitVersion | |
| inputs: | |
| versionSpec: "5.x" | |
| # Determine the semantic version | |
| - task: gitversion/execute@0 | |
| displayName: Calculating version | |
| inputs: | |
| useConfigFile: True | |
| configFilePath: ".azuredevops/gitversion.yml" | |
| # Update Build.BuildNumber to use SemVer, as by default it uses FullSemVer | |
| - pwsh: | | |
| Write-Host "##vso[build.updatebuildnumber]$(GitVersion.SemVer)" | |
| displayName: Update Build.BuildNumber | |
| # Adds the tag for the calculated semantic version | |
| - task: PowerShell@2 | |
| displayName: Adding git release tag | |
| inputs: | |
| targetType: inline | |
| script: | | |
| Write-Host "Configuring git author info.." -ForegroundColor Cyan | |
| git config user.email "Azure DevOps pipeline" | |
| git config user.name "Azure.Devops@pipeline.com" | |
| Write-Host "Adding git tag for release $(GitVersion.SemVer).." -ForegroundColor Cyan | |
| git tag -a $("v$(GitVersion.SemVer)") -m $("Release $(GitVersion.SemVer)") | |
| Write-Host "Doing git push.." -ForegroundColor Cyan | |
| git push --tags | |
| Write-Host "Done." -ForegroundColor Cyan | |
| ## Job to create release notes file and publish it to the wiki | |
| - job: CreateReleaseNotes | |
| displayName: Creating release notes | |
| dependsOn: CalculateVersion | |
| steps: | |
| # Generates a release notes file | |
| - task: XplatGenerateReleaseNotes@3 | |
| displayName: "Generate release notes" | |
| inputs: | |
| outputfile: '$(System.DefaultWorkingDirectory)\releasenotes.md' | |
| templateLocation: File | |
| templatefile: ".azuredevops/release-notes-template.md" | |
| dumpPayloadToConsole: false | |
| dumpPayloadToFile: false | |
| replaceFile: True | |
| getParentsAndChildren: False | |
| getAllParents: False | |
| getIndirectPullRequests: False | |
| stopOnError: True | |
| considerPartiallySuccessfulReleases: False | |
| # Publishes the release notes in the project wiki | |
| - task: WikiUpdaterTask@1 | |
| displayName: "Publish to the wiki" | |
| inputs: | |
| repo: "https://dev.azure.com/devruijter/playground/_git/playground.wiki" #REPLACE THIS!! NB. use _git instead of _wiki/wikis in the uri | |
| filename: "Release-Notes.md" #Note: want a space in the name of the page? Use a '-' here! | |
| replaceFile: false | |
| appendToFile: false | |
| dataIsFile: true | |
| sourceFile: '$(System.DefaultWorkingDirectory)\releasenotes.md' | |
| message: "Update from Pipeline" | |
| gitname: $(Release.RequestedFor) | |
| gitemail: $(Release.RequestedForEmail) | |
| useAgentToken: true | |
| localpath: '$(System.DefaultWorkingDirectory)\repo' |
delpierro140
commented
Oct 13, 2022
via email
I‘ve allready installed the package and it still doesn’t work
Von: Reece Noone ***@***.***>
Gesendet: Mittwoch, 12. Oktober 2022 09:32
An: DaveRuijter ***@***.***>
Cc: Glodek, Pierre ***@***.***>; Comment ***@***.***>
Betreff: Re: DaveRuijter/pipeline-release-administration.yml
@ReeceNoone commented on this gist.
…________________________________
##[error]Error: GitVersion configuration file not found at /home/vsts/work/1/s/.azuredevops/gitversion.yml I'm a newbie, and I don't know what is wrong here?
You need to install the extension first from https://marketplace.visualstudio.com/items?itemName=gittools.gittools
—
Reply to this email directly, view it on GitHub<https://gist.github.com/c72cecb255cd52d73aeae0f67cd0ee1e#gistcomment-4332433>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A3C2GN2LZFLI44OCOFBBDK3WCZSQPANCNFSM6AAAAAAQSZCH5U>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment