Skip to content

assertReleaseCommitLanded

Asserts that HEAD is the release commit: on the branch the release started on, a single commit on top of the commit it started from, with the chore: release <version> subject.

A successful git commit proves only that a commit was made somewhere. A checkout switched underneath a release by another process takes the commit onto that other branch, and when it is switched back the tag and the GitHub release go out on the commit before the bump, with the bump left staged in the working tree and nothing reported. So the release checks where the commit landed before tagging, and again before pushing.

Import:

import { assertReleaseCommitLanded } from '@mnaoumov/typescript-dev-toolkit/version';

Signature:

function assertReleaseCommitLanded(newVersion: string, startHead: GitHeadState, stage: string): Promise<string>

Parameters:

Parameter Type Description
newVersion string The version being released.
startHead GitHeadState Where HEAD stood when the release started.
stage string The step about to run, for the error message (for example tagging).

Returns: Promise<string> — A Promise that resolves to the release commit’s SHA.