Skip to content

Commit

Permalink
added a script to automate creating a release branch and associated pr (
Browse files Browse the repository at this point in the history
#2695)

* added a script to automate creating a release branch and associated pr

* updated script name to be more accurate
  • Loading branch information
corranrogue9 authored Sep 20, 2023
1 parent bb5db4b commit b144ff8
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## Directions

### Initiate the Release
1. Increment the version number and update the Public API files; both of these steps can be accomplished by running the `tools\IncrementVersion.cmd` script. Then create a pull request with these changes and merge it.
1. Increment the version number and update the Public API files; both of these steps can be accomplished by running the `tools\IncrementVersion.cmd` script. Then create a pull request with these changes using the `tools\Release\CreateAndPushBranch.cmd` script and merge the pull request.
* Increment the version number referenced during build in [`Versioning.props`](tools/CustomMSBuild/Versioning.props) by using [semantic versioning](https://semver.org/).
* Update the Public API files by copying the contents of any `PublicAPI.Unshipped.txt` file that has changed since the last release into its corresponding `PublicAPI.Shipped.txt` file.
2. Kick off a new [nightly build](https://identitydivision.visualstudio.com/OData/_build?definitionId=1104) by running the pipeline to generate the NuGet packages that will be published for this release.
Expand Down
3 changes: 3 additions & 0 deletions tools/Release/CreateAndPushBranch.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off

powershell.exe -executionpolicy remotesigned -File %~dpn0.ps1 %*
48 changes: 48 additions & 0 deletions tools/Release/CreateAndPushBranch.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<#
.PARAMETER versionPath
The path to the msbuild props file where the version number is specified
#>

Param(
[string]
$versionPath
)

if ($versionPath -eq "")
{
$versionPath = "$PSScriptRoot\..\CustomMSBuild\Versioning.props"
}

$versions = New-Object xml
$versions.PreserveWhitespace = $true
$versions.Load($versionPath)
foreach ($propertyGroup in $versions.Project.PropertyGroup)
{
if ($propertyGroup.VersionRelease -ne $null)
{
$versionNumber = $propertyGroup.VersionMajor.'#text' + "." + $propertyGroup.VersionMinor.'#text' + "." + $propertyGroup.VersionBuildNumber.'#text'

break;
}
}

if ($versionNumber -eq $null)
{
Write-Error "No version number was found in $versionPath."
Exit
}

$branchName = "releases/$versionNumber"

$branchName

git checkout -b $branchName

git add *
git commit -m "revving version number to $versionNumber and updating PublicAPI.Shipped.txt files to reflect API changes for this release"

git push --set-upstream origin $branchName

Write-Host
Write-Host -ForegroundColor Green "A new release branch at $branchName has been created and pushed; create a PR for that branch by navigating to:"
Write-Host -ForegroundColor Green "https://github.com/OData/odata.net/compare/master...$branchName"

0 comments on commit b144ff8

Please sign in to comment.