ap0llo / Cake.GitHubReleases

A Cake Addin to create GitHub Releases from a Cake Build.
MIT License
0 stars 0 forks source link
build cake cake-addin cake-build github github-releases

Cake.GitHubReleases


This Repository is no longer maintained

The functionality of this Cake Addin has been integrated into Cake.GitHub


A Cake Addin to create GitHub Releases from a Cake Build.

Usage

The addin currently provides a single Cake script alias GitHubReleaseCreateAsync().

To use the addin in a Cake script file, perform the following steps

  1. Add the preprocessor directive to install the addin

    #addin nuget:?package=Cake.GitHubReleases&version=VERSION
  2. To create a GitHub Release, call GitHubReleaseCreateAsync() from a task:

    Task("CreateGitHubRelease")
    .Does(async () =>
    {
        var settings = new GitHubReleaseCreateSettings(
            repositoryOwner: "owner", 
            repositoryName: "repo", 
            tagName: "v1.2.3")
        {
            // Set the name of the release (defaults to the tag name when not specified)
            Name = $"v1.2.3",
    
            // The release's description as Markdown string (optional)
            Body = "Description",
    
            // Set to true to create a draft release (default: false)
            Draft = false,
    
            // Set to true to mark the release as prerelease (default: false)
            Prerelease = false,
    
            // The id of the commit to create the release from 
            // (uses the HEAD commit of the repo's default branch if not specified)
            TargetCommitish = "abc123",
    
            // Set the GitHub access token to use for authentication
            AccessToken = accessToken,
    
            // Overwrite will delete any existing commit with the same tag name if it exists
            Overwrite = false
        };
    
        GitHubReleaseCreateAsync(settings);
    });

Building from source

Building the project from source requires the .NET 5 SDK (version 5.0.400 as specified in global.json).

To build the project, run

.\build.ps1

This will

Versioning and Branching

The version of the library is automatically derived from git and the information in version.json using Nerdbank.GitVersioning:

To create a new release branch use the nbgv tool:

dotnet tool install --global nbgv
nbgv prepare-release