Documentation
¶
Index ¶
- func DeriveHeadingVersionPattern(template string) string
- func DeriveTagPattern(template, env string) string
- func GlobPattern(template, env string) (string, error)
- func ParseVersion(template, tag string) (string, error)
- func Render(template, env, version, build string) (string, error)
- func ValidateBuildID(build string) error
- func ValidateVersionOverride(version string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeriveHeadingVersionPattern ¶ added in v0.20.0
DeriveHeadingVersionPattern returns a git-cliff postprocessor regex that strips every non-{version} token (env prefix/suffix and build) from a changelog version heading, leaving only the version. The replacement is "[$1]". Examples:
{version}_{env} [2026.3.0_prod] → [2026.3.0]
{env}/{version}-{build} [uat/7.4.1-158404] → [7.4.1]
{env}/{version} [prod/1.2.3] → [1.2.3]
Returns "" when there is nothing to strip — no {version}, or neither {env} nor {build} present (a plain or "v"-prefixed version heading is already clean).
All wildcards exclude "]" so a match can never span two headings (postprocessors run against the whole rendered document). The greedy version capture plus the anchored trailing token handle SemVer pre-release segments (e.g. 7.4.1-rc.1) under a "-" build separator without special-casing.
func DeriveTagPattern ¶ added in v0.20.0
DeriveTagPattern returns an anchored regex (for git-cliff --tag-pattern) that matches only the given environment's tags. {env} becomes the literal env, {version} and {build} become wildcards. Returns "" when the template has no {env} token or env is empty — there is nothing to scope in those cases.
func GlobPattern ¶
GlobPattern returns a git tag glob pattern for listing tags under the given env.
func ParseVersion ¶
ParseVersion extracts the version string from a tag using the given template.
func Render ¶
Render substitutes {version}, {env}, and {build} tokens in template. build may be empty when {build} is not present in the template; if {build} is present but build is empty, an error is returned.
func ValidateBuildID ¶ added in v0.19.0
ValidateBuildID checks that a build ID is usable as a tag component: non-empty, no "/" (path separator) and no whitespace (git ref constraints). CI build IDs like "$CI_PIPELINE_ID" and "$GITHUB_RUN_NUMBER" satisfy this.
func ValidateVersionOverride ¶ added in v0.32.0
ValidateVersionOverride checks that a --version value is usable as a tag/version override: non-empty and free of whitespace (git ref constraints). Unlike ValidateBuildID, "/" is allowed — a full tag override may legitimately contain one. heraut is strategy-agnostic about the shape of the override (SemVer, CalVer, or any other scheme the user's tag_format expects).
Types ¶
This section is empty.