Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions OneFlow/Finish-Feature.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
param($featurename)

. .\buildutils.ps1
$buildInfo = Initialize-BuildEnvironment

# feature branch merges must only be pushed from a repository with the official GitHub repository as the origin remote.
$remoteUrl = git ls-remote --get-url
if( $remoteUrl -ine "https://github.com/UbiquityDotNET/Llvm.NET.git" )
{
throw "Publishing a release tag is only allowed when the origin remote is the official source release current remote is '$remoteUrl'"
}

$featureBranchName = "feature/$featureName"
git checkout $featureBranchName
git pull
git rebase -i develop
git checkout develop
git merge --ff-only $featureBranchName
git push origin develop
git branch -d $featureBranchName
git push origin --delete $featureBranchName
59 changes: 59 additions & 0 deletions OneFlow/Publish-Release.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
. .\buildutils.ps1
$buildInfo = Initialize-BuildEnvironment

# determine release tag from the build version XML file in the branch
[xml]$buildVersionXml = Get-Content .\BuildVersion.xml
$buildVersionData = $buildVersionXml.BuildVersionData
$preReleaseSuffix=""
if(![string]::IsNullOrWhiteSpace($buildVersionData.PreReleaseName))
{
$preReleaseSuffix = "-$($buildVersionData.PreReleaseName)"
if(![string]::IsNullOrWhiteSpace($buildVersionData.PreReleaseNumber))
{
$preReleaseSuffix += ".$($buildVersionData.PreReleaseNumber)"
if(![string]::IsNullOrWhiteSpace($buildVersionData.PreReleaseFix))
{
$preReleaseSuffix += ".$($buildVersionData.PreReleaseFix)"
}
}
}

# Release tags must only be pushed from a repository with the official GitHub repository as the origin remote.
# This ensures that the links to source in the generated docs will have the correct URLs
# (e.g. docs pushed to the official repository MUST not have links to source in some private fork)
$remoteUrl = git ls-remote --get-url

Write-Information "Remote URL: $remoteUrl"

if($remoteUrl -ine "https://github.com/UbiquityDotNET/Llvm.NET.git")
{
throw "Publishing a release tag is only allowed when the origin remote is the official source release current remote is '$remoteUrl'"
}

# pushing the tag to GitHub triggers the official build and release of the Nuget Packages
$tagName = "v$($buildVersionData.BuildMajor).$($buildVersionData.BuildMinor).$($buildVersionData.BuildPatch)$preReleaseSuffix"
$releaseBranch = "release/$tagName"
$currentBranch = git rev-parse --abbrev-ref HEAD
if( $releaseBranch -ne $currentBranch )
{
throw "Current branch '$currentBranch' doesn't match the expected release branch from BuildVersion.xml, expected '$releaseBranch'"
}

$localCommitSha = git rev-parse --verify $releaseBranch
$remoteCommitSha = git rev-parse --verify "origin/$releaseBranch"
if( $localCommitSha -ne $remoteCommitSha )
{
throw "Local HEAD is not the same as origin, these must be in sync so that only the tag itself is pushed"
}

git tag -a $tagname -m "Official release: $tagname"
git checkout develop
git merge $releaseBranch
git push --tags origin develop
git branch -d $releaseBranch
git push origin --delete $releaseBranch

# update master branch to point to the latest release for full releases
git checkout master
git merge -ff-only $tagName
git push
9 changes: 9 additions & 0 deletions OneFlow/ReadMe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# GIT OneFlow support scripts
The scripts in this folder are used for release and feature branch management.
This repository follows the [OneFlow](https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow#develop-finishing-a-release-branch)
model and workflow. With one active long term branch 'develop'. (The master
branch is present and long term but is not active, it only points to the latest
official release (including preview releases) of the project. This is a convenience
to allow getting the latests released source quickly. Generally the scripts used here
are only for release managers with direct push permissions to the repository and are
not generally required for most contributors.
49 changes: 0 additions & 49 deletions Publish-Release.ps1

This file was deleted.