Release

Learn and practice the functionalities of release in the GitHub API.

Overview

A GitHub release is a deployable iteration of software packaged with binary files and release notes. It acts the same way as an application update. The binary files help users find a specific version of the application. The release notes include all the details of upgrades or features added to the product in that release. Releases are based on Git tags denoting a point in the repository’s history. These tags are essential in defining a release. The tag date will vary from the release date if they are created on different dates.

Create a release

A user must have push access to the repository to create a release. The table below shows the parameters in the body to create a release.

Request Parameters

Parameters

Type

Description

tag_name

String

The name of the tag

target_commitish

String

The value calculated based on where the Git tag is created from

name

String

The release name

body

String

The description of the tag’s contents

draft

Boolean

This is true if draft creation is enabled and false otherwise

prerelease

Boolean

This is true if the release is identified as prerelease. It is false if the release is identified as a full release.

discussion_category_name

String

The discussion of the category linked to the release, if specified

generate_release_notes

Boolean

This is true if the name and body of the release is to be automatically generated false otherwise

Let’s try creating a release by specifying <tag-name> in line 9. We extract and save the release ID to be used later in the lesson.

Press + to interact
Please provide values for the following:
ACCESS_TOKEN
Not Specified...
USERNAME
Not Specified...
REPOSITORY
Not Specified...
const endpointUrl = 'https://api.github.com/repos/{{USERNAME}}/{{REPOSITORY}}/releases';
const headers = {
Authorization: 'token {{ACCESS_TOKEN}}',
Accept: 'application/vnd.github.v3+json',
};
const body = JSON.stringify({
tag_name: '<tag-name>',
});
const options = {
method: 'POST',
headers,
body,
};
async function CreateRelease() {
try {
const response = await fetch(endpointUrl, options);
printResponse(response);
} catch (error) {
printErrors(error);
}
};
CreateRelease();

In case of ...