Skip to main content

Template Variables

Versionator uses Mustache templating. Use {{VariableName}} syntax in templates.

tip

Run versionator vars to see all variables with their current values.

Version Components

Core version numbers and formatting.

VariableDescriptionExample
{{Major}}Major version number1
{{Minor}}Minor version number2
{{Patch}}Patch version number3
{{MajorMinorPatch}}Core version: Major.Minor.Patch1.2.3
{{MajorMinor}}Major.Minor1.2
{{Prefix}}Version prefixv

Pre-release

Pre-release identifier variables.

VariableDescriptionExample
{{PreRelease}}Rendered pre-release identifieralpha-5
{{PreReleaseWithDash}}Pre-release with leading dash-alpha-5
{{PreReleaseLabel}}Label part of pre-releasealpha
{{PreReleaseNumber}}Number part of pre-release5

Build Metadata

Build metadata variables.

VariableDescriptionExample
{{Metadata}}Rendered build metadata20241211.abc1234
{{MetadataWithPlus}}Metadata with leading plus+20241211.abc1234

VCS / Git Information

Version control information.

VariableDescriptionExample
{{Hash}}Full commit hash (40 chars)abc1234def5678...
{{ShortHash}}Short commit hash (7 chars)abc1234
{{MediumHash}}Medium commit hash (12 chars)abc1234def01
{{BranchName}}Current branch namefeature/foo
{{EscapedBranchName}}Branch with slashes replacedfeature-foo
{{CommitsSinceTag}}Commits since last tag42
{{BuildNumber}}Alias for CommitsSinceTag42
{{BuildNumberPadded}}Padded to 4 digits0042
{{UncommittedChanges}}Count of uncommitted files3
{{Dirty}}'dirty' if uncommitted changes existdirty
{{VersionSourceHash}}Hash of commit that last tag points todef5678

Commit Information

Details about the current commit.

VariableDescriptionExample
{{CommitAuthor}}Commit author nameJohn Doe
{{CommitAuthorEmail}}Commit author emailjohn@example.com
{{CommitDate}}ISO 8601 commit date2024-01-15T10:30:00Z
{{CommitDateCompact}}Compact commit date20240115103045
{{CommitDateShort}}Date only2024-01-15
{{CommitYear}}Commit year2024
{{CommitMonth}}Commit month (zero-padded)01
{{CommitDay}}Commit day (zero-padded)15

Build Timestamps

Timestamps at build time.

VariableDescriptionExample
{{BuildDateTimeUTC}}ISO 8601 build time2024-01-15T10:30:00Z
{{BuildDateTimeCompact}}Compact build time20240115103045
{{BuildDateUTC}}Build date only2024-01-15
{{BuildYear}}Build year2024
{{BuildMonth}}Build month (zero-padded)01
{{BuildDay}}Build day (zero-padded)15