Skip to content

Add SDK release kickoff pipeline#677

Open
YunchuWang wants to merge 1 commit intomainfrom
wangbill/add-release-kickoff-pipeline
Open

Add SDK release kickoff pipeline#677
YunchuWang wants to merge 1 commit intomainfrom
wangbill/add-release-kickoff-pipeline

Conversation

@YunchuWang
Copy link
Member

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:

    • Takes user input for version bump type (\major/\minor/\patch/\�xplicit), explicit version, and optional version suffix
    • Bumps \VersionPrefix\ and \VersionSuffix\ in \�ng/targets/Release.props\
    • Runs \generate_changelog.py\ to update \CHANGELOG.md\ with the new version header
    • Creates a
      elease/v\ branch and pushes it
    • Opens a release PR targeting \main\ via the ADO REST API
  • *\�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:

  1. Navigate to the pipeline and click Run pipeline
  2. Select the version bump type (\major, \minor, \patch, or \�xplicit)
  3. If \�xplicit, provide the version in \X.Y.Z\ format
  4. Optionally set a version suffix (e.g., \preview,
    c.1)
  5. The pipeline creates a release branch and PR automatically

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.

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
Copilot AI review requested due to automatic review settings March 17, 2026 17:00
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants