Conventional GitHub Releaser is a Node.js library and CLI tool that automates the creation of GitHub releases from git metadata using conventional changelog conventions. It integrates with the conventional-changelog ecosystem to parse commit messages, extract meaningful information about features, fixes, performance improvements, and breaking changes, then automatically creates GitHub releases with properly formatted release notes.
npm install conventional-github-releaser (programmatic), npm install -g conventional-github-releaser (CLI)const conventionalGithubReleaser = require('conventional-github-releaser');For ES modules:
import conventionalGithubReleaser from 'conventional-github-releaser';const conventionalGithubReleaser = require('conventional-github-releaser');
// Basic programmatic usage
conventionalGithubReleaser({
token: 'your-github-token' // or use environment variable CONVENTIONAL_GITHUB_RELEASER_TOKEN
}, {
preset: 'angular' // conventional changelog preset
}, function(err, responses) {
if (err) {
console.error(err);
} else {
console.log('Release created successfully!');
}
});CLI usage:
# Install globally
npm install -g conventional-github-releaser
# Create release using angular preset
conventional-github-releaser -p angular
# Generate all previous releases (first time use)
conventional-github-releaser -p angular -r 0Conventional GitHub Releaser is built around several key components:
conventionalGithubReleaser function providing programmatic interfaceMain function for creating GitHub releases from git metadata using conventional changelog conventions.
/**
* Creates GitHub releases from git metadata
* @param {Object} auth - GitHub authentication object with token and optional url
* @param {Object} [changelogOpts] - Changelog generation options
* @param {Object} [context] - Template context variables
* @param {Object} [gitRawCommitsOpts] - Git raw commits options
* @param {Object} [parserOpts] - Parser options for commit parsing
* @param {Object} [writerOpts] - Writer options for output formatting
* @param {Function} callback - Callback function with signature (err, responses)
*/
function conventionalGithubReleaser(
auth,
changelogOpts,
context,
gitRawCommitsOpts,
parserOpts,
writerOpts,
callback
);Transform function for processing changelog data chunks, extracting version information from git tags and formatting committer dates.
/**
* Transform function for processing changelog data chunks
* @param {Object} chunk - Data chunk containing gitTags and committerDate properties
* @param {Function} cb - Callback function with signature (err, transformedChunk)
*/
function transform(chunk, cb);interface AuthObject {
/** GitHub Personal Token with repo scope permissions */
token: string;
/** GitHub API URL (defaults to 'https://api.github.com') */
url?: string;
}interface ChangelogOptions {
/** Conventional changelog preset (angular, atom, codemirror, ember, eslint, express, jquery, jscs, jshint) */
preset?: string;
/** Number of releases to generate (default: 1, 0 for all) */
releaseCount?: number;
/** Whether to create draft releases (default: false) */
draft?: boolean;
/** Release name override (defaults to version tag) */
name?: string;
/** Target commit/branch for release */
targetCommitish?: string;
/** Custom transform function */
transform?: Function;
/** Debug logging function */
debug?: Function;
/** Warning logging function */
warn?: Function;
}interface TemplateContext {
/** Repository owner */
owner?: string;
/** Repository name */
repository?: string;
/** Additional template variables */
[key: string]: any;
}interface GitRawCommitsOptions {
/** Starting commit/tag for changelog generation */
from?: string;
/** Ending commit/tag for changelog generation (defaults to latest semver tag) */
to?: string;
/** Additional git options */
[key: string]: any;
}The library uses Node.js callback patterns for error handling:
Error if auth object is missingError if callback function is missing