Releaser Tools is a monorepo containing conventional release tools for creating GitHub and GitLab releases from git metadata using conventional changelog patterns. It provides both programmatic APIs and CLI tools for automating release creation based on conventional commit history.
npm install conventional-github-releasernpm install conventional-gitlab-releasernpm install -g conventional-github-releaser conventional-gitlab-releaserFor GitHub releases:
const conventionalGithubReleaser = require('conventional-github-releaser');For GitLab releases:
const conventionalGitlabReleaser = require('conventional-gitlab-releaser');const conventionalGithubReleaser = require('conventional-github-releaser');
conventionalGithubReleaser({
token: 'your-github-token',
url: 'https://api.github.com'
}, {
preset: 'angular',
releaseCount: 1
}, (err, responses) => {
if (err) {
console.error('Failed to create release:', err);
return;
}
console.log('Successfully created releases:', responses);
});const conventionalGitlabReleaser = require('conventional-gitlab-releaser');
conventionalGitlabReleaser({
token: 'your-gitlab-token',
url: 'https://gitlab.com'
}, {
preset: 'angular',
releaseCount: 1
}, (err, responses) => {
if (err) {
console.error('Failed to create release:', err);
return;
}
console.log('Successfully created releases:', responses);
});# GitHub releases
export CONVENTIONAL_GITHUB_RELEASER_TOKEN="your-github-token"
conventional-github-releaser -p angular
# GitLab releases
export CONVENTIONAL_GITLAB_RELEASER_TOKEN="your-gitlab-token"
conventional-gitlab-releaser -p angular -u https://gitlab.comThe releaser-tools monorepo is structured around two main packages that share common functionality:
Both tools share the same architecture pattern:
The release workflow is identical for both platforms:
git-semver-tagsconventional-changelogBoth packages depend on:
conventional-changelog: For generating structured changelogsgit-semver-tags: For extracting semantic version tags from gitdateformat: For date formatting in transform operationssemver-regex: For parsing semantic versions from git tagsthrough2: For stream processingq: For promise handlinggh-got for GitHub, gl-got for GitLab)Create GitHub releases from conventional commits with full customization options.
function conventionalGithubReleaser(
auth,
changelogOpts,
context,
gitRawCommitsOpts,
parserOpts,
writerOpts,
callback
);Create GitLab releases from conventional commits with GitLab-specific features.
function conventionalGitlabReleaser(
auth,
changelogOpts,
context,
gitRawCommitsOpts,
parserOpts,
writerOpts,
callback
);Shared utility for processing git commit chunks to extract version information and format dates.
function transform(chunk, callback);Both packages include identical transform functionality for processing git commit data:
Usage Example:
const transform = require('conventional-github-releaser/src/transform');
// or
const transform = require('conventional-gitlab-releaser/src/transform');
const gitChunk = {
gitTags: ' (tag: v1.2.3, origin/master)',
committerDate: 'June 8, 2012'
};
transform(gitChunk, (err, transformedChunk) => {
if (err) throw err;
console.log(transformedChunk.version); // 'v1.2.3'
console.log(transformedChunk.committerDate); // '2012-06-08'
});/**
* Authentication configuration object
*/
interface AuthConfig {
/** Platform auth token (GitHub PAT or GitLab token) */
token: string;
/** Platform API URL */
url?: string; // defaults to 'https://api.github.com' for GitHub, 'https://gitlab.com' for GitLab
}
/**
* Changelog generation options
*/
interface ChangelogOptions {
/** Commit convention preset name */
preset?: 'angular' | 'atom' | 'codemirror' | 'ember' | 'eslint' | 'express' | 'jquery' | 'jscs' | 'jshint';
/** Number of releases to generate (0 = regenerate all) */
releaseCount?: number;
/** Create draft releases instead of published (GitHub only) */
draft?: boolean;
/** Custom name for the release (defaults to version tag) */
name?: string;
/** Specific target_commitish for release (GitHub only) */
targetCommitish?: string;
/** Custom transform function for processing commits */
transform?: Function;
/** Package configuration */
pkg?: {
/** Path to package.json file */
path?: string;
};
/** Debug logging function */
debug?: Function;
/** Warning logging function */
warn?: Function;
}
/**
* Template context variables
*/
interface TemplateContext {
/** Repository owner */
owner: string;
/** Repository name */
repository: string;
}
/**
* Git commit parsing options
*/
interface GitRawCommitsOptions {
/** Starting commit/tag for range */
from?: string;
/** Ending commit/tag for range */
to?: string;
}
/**
* Git commit chunk processed by transform
*/
interface GitCommitChunk {
/** Git tag information from git log */
gitTags?: string;
/** Commit date */
committerDate?: string;
/** Extracted semantic version (added by transform) */
version?: string;
}
/**
* Platform API response for release creation
*/
interface ReleaseResponse {
/** HTTP status code */
statusCode: number;
/** Response body containing release data */
body: {
/** Release ID */
id: number;
/** Release URL */
html_url?: string; // GitHub
web_url?: string; // GitLab
/** Release tag name */
tag_name: string;
/** Release name */
name: string;
/** Release body/description */
body?: string;
description?: string; // GitLab
/** Whether release is a draft (GitHub only) */
draft?: boolean;
/** Whether release is a prerelease */
prerelease?: boolean;
};
}
/**
* Callback function type for release operations
*/
type ReleaseCallback = (
err: Error | null,
responses?: ReleaseResponse[]
) => void;
/**
* Transform callback function type
*/
type TransformCallback = (
err: Error | null,
chunk?: GitCommitChunk
) => void;Both tools handle similar error conditions:
Required Parameter Errors:
Error('Expected an auth object') if auth parameter is missingError('Expected an callback') if callback parameter is missingGit Repository Errors:
Error('No semver tags found') via callback if repository has no semantic version tagsPlatform API Errors:
Configuration Errors:
Both tools support the same conventional commit presets:
Each preset defines specific commit message parsing rules and changelog formatting templates optimized for that project's workflow.