Working with Releases

Get All

To retrieve all releases for a repository:

var releases = client.Repository.Release.GetAll("octokit", "");
var latest = releases[0];
    "The latest release is tagged at {0} and is named {1}", 


To create a new release you must have a corresponding tag in the repository. See the docs for details.

var newRelease = new NewRelease("v1.0.0");
newRelease.Name = "Version One Point Oh";
newRelease.Body = "**This** is some *Markdown*";
newRelease.Draft = true;
newRelease.Prerelease = false;

var result = await client.Repository.Release.Create("octokit", "", newRelease);
Console.WriteLine("Created release id {0}", result.Id);

Note that the Draft flag is used to indicate when a release should be published to the world, whereas the PreRelease flag is used to indicate whether a release is unofficial or preview release.


Once the release is ready for the public, you can apply an update to the release:

var release = client.Repository.Release.Get("octokit", "", 1);
var updateRelease = release.ToUpdate();
updateRelease.Draft = false;
updateRelease.Name = "Version 1.0";
updateRelease.TargetCommitish = "0edef870ecd885cc6506f1e3f08341e8b87370f2" // can also be a ref
var result = await client.Repository.Release.Edit("octokit", "", 1, updateRelease);

Upload Assets

If you have any assets to include with the release, you can upload them after creating the release:

using(var archiveContents = File.OpenRead("")) { // TODO: better sample
    var assetUpload = new ReleaseAssetUpload() 
         FileName = "",
         ContentType = "application/zip",
         RawData = archiveContents
    var release = client.Repository.Release.Get("octokit", "", 1);
    var asset = await client.Repository.Release.UploadAsset(release, assetUpload);

TODO: are there any known limits documented to upload assets?