Skip to content

Releaser

The Releaser runs the release as a chain of steps. Calling a step method queues it; run() executes the queue in order. This makes the pipeline explicit — every flow, including the GitHub Action ones, is just a different chain.

Continuing the Python project example:

release.js
import { Releaser } from '@simple-release/core'
import { GithubHosting } from '@simple-release/github'
import { PythonProject } from './python-project.js'
await new Releaser({
project: new PythonProject(),
hosting: new GithubHosting({
token: process.env.GITHUB_TOKEN
})
})
.bump()
.commit()
.tag()
.push()
.publish()
.release()
.run()

On a repository released as 1.1.0 with a feat commit, this writes 1.2.0 to pyproject.toml, prepends the section to CHANGELOG.md, commits chore(release): 1.2.0, tags v1.2.0, pushes, uploads the package with twine, and creates the GitHub release.

OptionDescription
projectThe project to release. Required.
hostingThe hosting for releases and pull requests. Optional.
dryRunDo not write files or perform git and API calls — log what would happen.
verboseLog more information.
silentDo not log anything.

Set dryRun: true to preview a release safely — the version is bumped in memory and every step reports what it would do.

StepDescription
setUser(options)Set the git user for the following commits.
checkout(branch, options)Check out the branch for release changes.
bump(options)Bump the version and generate the changelog.
commit(options)Commit the changes with the release message.
maintenanceBranch(options)Create maintenance branches for previous majors. Disabled by default.
tag(options)Create the release tags.
push(options)Push changes to the remote.
publish(options)Publish the project — delegated to the project addon.
release(options)Create the hosting release.
pullRequest(options)Create the release pull request on the hosting.
revert(options)Revert version updates made during the run.
run(condition)Execute the queued steps. The optional async condition receives the releaser and can cancel the whole run by returning false.

Step options can be passed directly to the step call, or set as defaults for the whole run with setOptions — that is what the config file feeds:

releaser
.setOptions({
bump: {
extraScopes: ['deps']
}
})
OptionDescription
versionForce a specific version.
asForce a release type: major, minor, patch, or prerelease.
prereleasePre-release identifier for prerelease bumps.
snapshotPre-release identifier with a timestamp suffix for snapshot builds. Always applied when set.
skipChangelogUpdate versions without generating the changelog.
firstReleaseTreat the current version as the first release. Auto-detected by default.
skipSkip the version bump.
forcePrivateAllow bumping private packages.
presetConventional changelog preset configuration. Defaults to conventionalcommits.
tagPrefixPrefix for release tags. Defaults to v.
extraScopesExtra commit scopes counted towards every package in a monorepo.
byProjectPer-package bump options for monorepos, keyed by package name.
OptionDescription
enabledEnable maintenance branch creation. Defaults to false.
forceRecreate an existing maintenance branch.
branchPrefixPrefix for the branch name. Defaults to the tag prefix.
OptionDescription
fetchFetch fresh tags from the remote before tagging.
signSign the created tags.
OptionDescription
forceForce-push the changes.

Publish options are defined by the project addon — see npm, pnpm, and GitHub Action. Common ones:

OptionDescription
skipSkip publishing.
tagnpm dist-tag or a formatter function. When not set, prereleases get their prerelease identifier and maintenance releases get release-N.x.
gitChecksWhether to run the package manager git checks before publishing, when the addon supports it.

Defined by the hosting addon.

run accepts a condition — the GitHub Action uses this to run the release chain only on release commits:

import { ifReleaseCommit } from '@simple-release/github-action'
await releaser
.tag()
.push()
.publish()
.release()
.run(ifReleaseCommit)