From a CI perspective, you may be willing to build a specific branch.
The following piece of code demonstrates this.
using (Repository repo = Repository.Clone(url, localPath))
{
// Retrieve the branch to build
var branchToBuild = repo.Branches["vNext"];
// Updates the content of the working directory with the content of the branch
branchToBuild.Checkout();
// Perform your build magic here ;-)
Build();
// Retrieve the commit sha of the branch that has just been built
string sha = branchToBuild.Tip.Sha;
// Package your build artifacts using the sha to name the package
Package(sha);
}
Note: url
can either point to:
- a remote http url (
http://www.example.com/repo.git
) - a location on the CI server (
file:///C:/My%20Documents/repo.git
) - a location on the network (
file://server/repos/repo.git
)