Release
Learn and practice the functionalities of release in the GitHub API.
We'll cover the following...
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 |
| String | The name of the tag |
| String | The value calculated based on where the Git tag is created from |
| String | The release name |
| String | The description of the tag’s contents |
| Boolean | This is |
| Boolean | This is |
| String | The discussion of the category linked to the release, if specified |
| Boolean | This is |
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.
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 ...