How to use conventional-github-releaser


This post goes over how to generate a GitHub release using conventional-github-releaser. See the repository that this post is based on.

Instructions

Given you have a Git repository, commit a message following the Conventional Commits format.

Here’s a sample from Angular’s commit message guidelines:

git commit -m 'docs(changelog): update changelog to beta.5'

Run standard-version:

npx standard-version

standard-version bumps the version and generates CHANGELOG.md.

Create a new token. Select the scope public_repo (or repo for access to private repositories).

Run conventional-github-releaser with the token set as the environment variable:

CONVENTIONAL_GITHUB_RELEASER_TOKEN=<MY_TOKEN> npx conventional-github-releaser

conventional-github-releaser creates a GitHub release from the Git metadata.

Besides using the environment variable CONVENTIONAL_GITHUB_RELEASER_TOKEN, the token can also be passed via the flag -t or --token:

npx conventional-github-releaser -t <MY_TOKEN>

To see a demo, check out conventional-github-releaser-demo.

FAQ

Why is conventional-github-releaser failing with GitHubError: Validation Failed (422)?

This can happen for several reasons:

  • The release for the version already exists on GitHub.
  • The repository url is invalid in package.json.

See conventional-changelog/releaser-tools#50 for more details.

How can I debug conventional-github-releaser?

Set the environment variable DEBUG=conventional-github-releaser before running the command:

DEBUG=conventional-github-releaser npx conventional-github-releaser


Please support this site and join our Discord!