Skip to content

Commit de25531

Browse files
committed
Moved release management scripts to dedicated 'OneFlow' folder
1 parent 9b4ce81 commit de25531

File tree

4 files changed

+89
-49
lines changed

4 files changed

+89
-49
lines changed

OneFlow/Finish-Feature.ps1

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
param($featurename)
2+
3+
. .\buildutils.ps1
4+
$buildInfo = Initialize-BuildEnvironment
5+
6+
# feature branch merges must only be pushed from a repository with the official GitHub repository as the origin remote.
7+
$remoteUrl = git ls-remote --get-url
8+
if( $remoteUrl -ine "https://github.com/UbiquityDotNET/Llvm.NET.git" )
9+
{
10+
throw "Publishing a release tag is only allowed when the origin remote is the official source release current remote is '$remoteUrl'"
11+
}
12+
13+
$featureBranchName = "feature/$featureName"
14+
git checkout $featureBranchName
15+
git pull
16+
git rebase -i develop
17+
git checkout develop
18+
git merge --ff-only $featureBranchName
19+
git push origin develop
20+
git branch -d $featureBranchName
21+
git push origin --delete $featureBranchName

OneFlow/Publish-Release.ps1

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
. .\buildutils.ps1
2+
$buildInfo = Initialize-BuildEnvironment
3+
4+
# determine release tag from the build version XML file in the branch
5+
[xml]$buildVersionXml = Get-Content .\BuildVersion.xml
6+
$buildVersionData = $buildVersionXml.BuildVersionData
7+
$preReleaseSuffix=""
8+
if(![string]::IsNullOrWhiteSpace($buildVersionData.PreReleaseName))
9+
{
10+
$preReleaseSuffix = "-$($buildVersionData.PreReleaseName)"
11+
if(![string]::IsNullOrWhiteSpace($buildVersionData.PreReleaseNumber))
12+
{
13+
$preReleaseSuffix += ".$($buildVersionData.PreReleaseNumber)"
14+
if(![string]::IsNullOrWhiteSpace($buildVersionData.PreReleaseFix))
15+
{
16+
$preReleaseSuffix += ".$($buildVersionData.PreReleaseFix)"
17+
}
18+
}
19+
}
20+
21+
# Release tags must only be pushed from a repository with the official GitHub repository as the origin remote.
22+
# This ensures that the links to source in the generated docs will have the correct URLs
23+
# (e.g. docs pushed to the official repository MUST not have links to source in some private fork)
24+
$remoteUrl = git ls-remote --get-url
25+
26+
Write-Information "Remote URL: $remoteUrl"
27+
28+
if($remoteUrl -ine "https://github.com/UbiquityDotNET/Llvm.NET.git")
29+
{
30+
throw "Publishing a release tag is only allowed when the origin remote is the official source release current remote is '$remoteUrl'"
31+
}
32+
33+
# pushing the tag to GitHub triggers the official build and release of the Nuget Packages
34+
$tagName = "v$($buildVersionData.BuildMajor).$($buildVersionData.BuildMinor).$($buildVersionData.BuildPatch)$preReleaseSuffix"
35+
$releaseBranch = "release/$tagName"
36+
$currentBranch = git rev-parse --abbrev-ref HEAD
37+
if( $releaseBranch -ne $currentBranch )
38+
{
39+
throw "Current branch '$currentBranch' doesn't match the expected release branch from BuildVersion.xml, expected '$releaseBranch'"
40+
}
41+
42+
$localCommitSha = git rev-parse --verify $releaseBranch
43+
$remoteCommitSha = git rev-parse --verify "origin/$releaseBranch"
44+
if( $localCommitSha -ne $remoteCommitSha )
45+
{
46+
throw "Local HEAD is not the same as origin, these must be in sync so that only the tag itself is pushed"
47+
}
48+
49+
git tag -a $tagname -m "Official release: $tagname"
50+
git checkout develop
51+
git merge $releaseBranch
52+
git push --tags origin develop
53+
git branch -d $releaseBranch
54+
git push origin --delete $releaseBranch
55+
56+
# update master branch to point to the latest release for full releases
57+
git checkout master
58+
git merge -ff-only $tagName
59+
git push

OneFlow/ReadMe.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# GIT OneFlow support scripts
2+
The scripts in this folder are used for release and feature branch management.
3+
This repository follows the [OneFlow](https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow#develop-finishing-a-release-branch)
4+
model and workflow. With one active long term branch 'develop'. (The master
5+
branch is present and long term but is not active, it only points to the latest
6+
official release (including preview releases) of the project. This is a convenience
7+
to allow getting the latests released source quickly. Generally the scripts used here
8+
are only for release managers with direct push permissions to the repository and are
9+
not generally required for most contributors.

Publish-Release.ps1

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)