I recently had to come up with a solution to perform a bulk deploy of all apps to an environment using the latest build artifacts. I wanted to use a “wrapper” release definition to orchestrate all of the deployments; similar to how Octopus Deploy’s “Deploy Release Step” works.
However, TFS Release Management currently lacks functionality to create releases from within a build or release definition. There are 3rd party extensions to queue/trigger other builds within a build definition, but nothing to create releases.
I created a PowerShell script, CreateRelease.ps1, that creates a new release for the specified release definition name, using the latest artifact versions available. I created a new “wrapper” release definition, that has multiple “Run a PowerShell script” steps that run CreateRelease.ps1, for each release definition I want to create releases for.
At a high level level, the steps that the script performs are as follows:
- Finds release definition using $ReleaseDefinitionName that’s passed as an argument
- Gets list of all linked artifacts
- Gets list of artifact versions
- Creates a new release using latest version of linked artifacts
- Wait for deployment to complete (triggered upon release creation)