Skip to content

Version File Updates

When brel release-pr runs, it writes the next version into the files you list in [release_pr.version_updates] — a map from exact repo-relative file paths to arrays of selectors that locate the version strings inside each file.

[release_pr.version_updates]
"package.json" = ["version"]
"Cargo.toml" = ["package.version"]

Paths must be repo-relative: absolute paths and paths containing .. are rejected at config load time.

A selector is a dot-separated path of segments. Each segment names a key and may carry one qualifier in square brackets:

Form Example Meaning
Key version Top-level version key.
Nested key package.version version inside the package object/table.
Index qualifier packages[0].version version of the first element of the packages array.
Filter qualifier package[name=brel].version version of every package array element whose name equals brel.

Rules worth knowing:

  • Qualifiers can’t nest (a[b[0]] is invalid) and brackets must balance.
  • A filter is a single field=value equality test.
  • All values matched by a selector are updated — a filter matching three array elements updates three version strings.
  • Selectors never create missing keys or paths; they only rewrite existing string values.

Format is inferred from the file extension (.json, .toml). For files whose extension doesn’t reveal the format, force it with [release_pr.format_overrides]:

[release_pr.version_updates]
"Cargo.lock" = ["package[name=my-crate].version"]
[release_pr.format_overrides]
"Cargo.lock" = "toml"

Every format_overrides key must also appear in version_updates.

File updates are strict. brel release-pr errors out if:

  • a listed file is missing,
  • the format cannot be determined,
  • the file fails to parse,
  • a selector is syntactically invalid,
  • a selector matches no values,
  • a selector uses an index/filter qualifier on a segment that isn’t an array,
  • a matched value is not a string.

This is deliberate: a release PR with a silently un-bumped version file is worse than a failed CI run.

[release_pr.version_updates]
# Multiple selectors per file
"package.json" = ["version", "tooling.release.version"]
# JSON array with a filter
"packages.json" = ["package[name=brel].version"]
# Workspace member in a TOML file
"Cargo.toml" = ["package.version"]