Open
Conversation
Add an Azure DevOps pipeline (eng/ci/release-kickoff.yml) and a local PowerShell helper (eng/scripts/Start-Release.ps1) to automate the SDK release kickoff process: - Pipeline parameters for bump type (major/minor/patch/explicit), explicit version, and version suffix - Bumps VersionPrefix/VersionSuffix in eng/targets/Release.props - Generates changelog update via generate_changelog.py - Creates a release/v<version> branch and pushes it - Opens a release PR targeting main
Contributor
There was a problem hiding this comment.
Pull request overview
Adds automation for starting an SDK release by bumping versioning props, updating the changelog, creating a release branch, and opening a release PR.
Changes:
- Add a PowerShell script to kick off a release from a developer machine.
- Add an Azure Pipelines YAML definition intended to perform the same release kickoff steps in CI.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.
| File | Description |
|---|---|
| eng/scripts/Start-Release.ps1 | New local release kickoff script (version bump, changelog update, release branch + PR). |
| eng/ci/release-kickoff.yml | New CI pipeline to automate the release kickoff steps. |
You can also share your feedback on Copilot code review. Take the survey.
Comment on lines
+113
to
+118
| Write-Host "Generating changelog for tag '$VersionTag'..." | ||
|
|
||
| # Run the changelog generator | ||
| $changelogEntry = & python $changelogScript --tag $VersionTag 2>&1 | ||
| if ($LASTEXITCODE -ne 0) { | ||
| Write-Warning "Changelog generation returned non-zero exit code. Output: $changelogEntry" |
| Write-Host "Generating changelog for tag '$VersionTag'..." | ||
|
|
||
| # Run the changelog generator | ||
| $changelogEntry = & python $changelogScript --tag $VersionTag 2>&1 |
| Write-Host "Creating release branch: $branchName" | ||
|
|
||
| Push-Location $repoRoot | ||
| try { |
Comment on lines
+96
to
+105
| $content = Get-Content $releasePropsPath -Raw | ||
|
|
||
| # Update VersionPrefix | ||
| $content = $content -replace '<VersionPrefix>[^<]*</VersionPrefix>', "<VersionPrefix>$NewVersion</VersionPrefix>" | ||
|
|
||
| # Update VersionSuffix | ||
| $content = $content -replace '<VersionSuffix>[^<]*</VersionSuffix>', "<VersionSuffix>$Suffix</VersionSuffix>" | ||
|
|
||
| Set-Content -Path $releasePropsPath -Value $content -NoNewline | ||
| Write-Host "Updated $releasePropsPath -> VersionPrefix=$NewVersion, VersionSuffix=$Suffix" |
Comment on lines
+118
to
+119
| # Insert the new version header after "## Unreleased" and a blank line | ||
| $updatedChangelog = $existingChangelog -replace '(## Unreleased\r?\n)', "`$1`n## v$fullVersion`n" |
Comment on lines
+176
to
+206
| # Create PR using the Azure DevOps REST API | ||
| $org = $env:SYSTEM_COLLECTIONURI | ||
| $project = $env:SYSTEM_TEAMPROJECT | ||
| $repoId = $env:BUILD_REPOSITORY_ID | ||
|
|
||
| $url = "${org}${project}/_apis/git/repositories/${repoId}/pullrequests?api-version=7.1" | ||
|
|
||
| $body = @{ | ||
| sourceRefName = "refs/heads/$branchName" | ||
| targetRefName = "refs/heads/main" | ||
| title = $prTitle | ||
| description = $prBody | ||
| } | ConvertTo-Json -Depth 10 | ||
|
|
||
| $headers = @{ | ||
| 'Content-Type' = 'application/json' | ||
| 'Authorization' = "Bearer $(System.AccessToken)" | ||
| } | ||
|
|
||
| try { | ||
| $response = Invoke-RestMethod -Uri $url -Method Post -Headers $headers -Body $body | ||
| Write-Host "Pull request created: $($response.url)" | ||
| Write-Host "PR ID: $($response.pullRequestId)" | ||
| } | ||
| catch { | ||
| Write-Warning "Failed to create PR via ADO API: $_" | ||
| Write-Host "You can create the PR manually at: https://github.com/$repo/compare/main...$branchName" | ||
| } | ||
| displayName: 'Open release pull request' | ||
| env: | ||
| SYSTEM_ACCESSTOKEN: $(System.AccessToken) |
|
|
||
| $headers = @{ | ||
| 'Content-Type' = 'application/json' | ||
| 'Authorization' = "Bearer $(System.AccessToken)" |
Comment on lines
+51
to
+108
| - pwsh: | | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| $repoRoot = "$(Build.SourcesDirectory)" | ||
| $releasePropsPath = Join-Path $repoRoot 'eng/targets/Release.props' | ||
| $changelogPath = Join-Path $repoRoot 'CHANGELOG.md' | ||
| $changelogScript = Join-Path $repoRoot 'generate_changelog.py' | ||
|
|
||
| $bumpType = '${{ parameters.bumpType }}' | ||
| $explicitVersion = '${{ parameters.explicitVersion }}' | ||
| $versionSuffix = '${{ parameters.versionSuffix }}' | ||
|
|
||
| # --- Read current version --- | ||
| [xml]$props = Get-Content $releasePropsPath -Raw | ||
| $currentVersion = $props.Project.PropertyGroup.VersionPrefix.Trim() | ||
| Write-Host "Current version: $currentVersion" | ||
|
|
||
| # --- Compute new version --- | ||
| if ($bumpType -eq 'explicit') { | ||
| if (-not $explicitVersion) { | ||
| throw "explicitVersion parameter is required when bumpType is 'explicit'." | ||
| } | ||
| if ($explicitVersion -notmatch '^\d+\.\d+\.\d+$') { | ||
| throw "explicitVersion must be in the format 'X.Y.Z'. Got: '$explicitVersion'" | ||
| } | ||
| $newVersion = $explicitVersion | ||
| } | ||
| else { | ||
| $parts = $currentVersion.Split('.') | ||
| [int]$major = $parts[0] | ||
| [int]$minor = $parts[1] | ||
| [int]$patch = $parts[2] | ||
|
|
||
| switch ($bumpType) { | ||
| 'major' { $major++; $minor = 0; $patch = 0 } | ||
| 'minor' { $minor++; $patch = 0 } | ||
| 'patch' { $patch++ } | ||
| } | ||
| $newVersion = "$major.$minor.$patch" | ||
| } | ||
|
|
||
| $fullVersion = $newVersion | ||
| if ($versionSuffix) { | ||
| $fullVersion = "$newVersion-$versionSuffix" | ||
| } | ||
|
|
||
| Write-Host "New version: $newVersion" | ||
| Write-Host "Full version: $fullVersion" | ||
| Write-Host "##vso[task.setvariable variable=NewVersion]$newVersion" | ||
| Write-Host "##vso[task.setvariable variable=FullVersion]$fullVersion" | ||
| Write-Host "##vso[task.setvariable variable=VersionSuffix]$versionSuffix" | ||
|
|
||
| # --- Update Release.props --- | ||
| $content = Get-Content $releasePropsPath -Raw | ||
| $content = $content -replace '<VersionPrefix>[^<]*</VersionPrefix>', "<VersionPrefix>$newVersion</VersionPrefix>" | ||
| $content = $content -replace '<VersionSuffix>[^<]*</VersionSuffix>', "<VersionSuffix>$versionSuffix</VersionSuffix>" | ||
| Set-Content -Path $releasePropsPath -Value $content -NoNewline | ||
| Write-Host "Updated Release.props" |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds an automated SDK release kickoff pipeline and a local PowerShell helper script to streamline the release process.
New Files
*\�ng/ci/release-kickoff.yml* — Azure DevOps pipeline (manually triggered) that:
elease/v\ branch and pushes it
*\�ng/scripts/Start-Release.ps1* — Local PowerShell script for the same workflow (useful for running locally or in other CI systems). Uses \gh\ CLI to open the PR.
How to Use
In Azure DevOps:
c.1)
Locally:
\\powershell
Minor version bump (1.22.0 -> 1.23.0)
./eng/scripts/Start-Release.ps1 -BumpType minor
Patch bump with preview suffix
./eng/scripts/Start-Release.ps1 -BumpType patch -VersionSuffix preview
Explicit version
./eng/scripts/Start-Release.ps1 -BumpType explicit -ExplicitVersion 2.0.0
\\
Motivation
Follows the existing release process documented in \doc/release_process.md\ but automates steps 1–3 (version bump, changelog update, and branch creation) to reduce manual effort and risk of errors.