brel-0.6.0 is not a library.
brel
brel is a CLI that scaffolds and runs the better-releases workflow.
Commands
brel initgenerates a managed GitHub Actions workflow.brel release-prcomputes the next version, updates configured files, commits, pushes, and creates/updates a release PR.brel next-versioncomputes the next releasable version and prints it as plain SemVer.brel validatevalidates a config file and prints warnings for ignored keys.
release-pr Prerequisites
gitmust be available.gh(GitHub CLI) must be available.- A GitHub token must be present in
GH_TOKENorGITHUB_TOKEN.- The workflow generated by
brel initsetsGH_TOKEN: ${{ github.token }}automatically.
- The workflow generated by
Config File
brel discovers config in this order:
--config <path>(when provided)brel.toml.brel.toml
Use brel validate to check that an existing config file parses and satisfies the current schema before running other commands.
Minimal release-pr config
= "github"
= "main"
[]
= ["version"]
Full release_pr config
[]
= ["version"]
= ["package.version"]
[]
= "toml"
[]
= "brel/release/v{{version}}"
= ".github/brel/release-pr-body.hbs"
[]
= true
= "CHANGELOG.md"
[]
= false
= "v{version}"
[]
= "brel[bot]"
= "brel[bot]@users.noreply.github.com"
How Versioning Works
When you run brel release-pr:
- It finds the highest stable SemVer tag that matches
release_pr.tagging.tag_template(defaultv{version}). - If no valid tag exists, it uses
0.0.0. - It scans commits since that tag (or all commits when no tag exists).
- It picks one bump level from Conventional Commit signals:
- major:
BREAKING CHANGEin body/footer, or!in the type/scope prefix. - minor:
feat: ... - patch:
fix: ...
- major:
- If no releasable commits are found, it exits successfully with no changes.
brel next-version uses the same versioning rules:
- when releasable commits exist, it prints the next version (for example
1.2.3) - when none exist, it prints nothing and exits successfully
How File Updates Work
release_pr.version_updatesmaps exact repo-relative file paths to selector paths.- Selector syntax:
- key:
version - nested key:
package.version - index selector:
packages[0].version - filter selector:
package[name=brel].version
- key:
- Supported file formats:
- inferred from extension (
.json,.toml) - or forced via
release_pr.format_overrides
- inferred from extension (
- Updates are fail-fast. The command errors if:
- a file is missing,
- format cannot be determined,
- parse fails,
- a selector is invalid,
- a selector matches no values,
- a selector uses index/filter on a non-array segment,
- a matched value is not a string.
- Match behavior:
- all values matched by a selector are updated
- selectors do not create missing keys/paths
Example selectors:
- JSON:
"package.json" = ["version", "tooling.release.version"] - JSON with filter:
"package.json" = ["package[name=brel].version"] - TOML:
"Cargo.toml" = ["package.version"] - Cargo.lock (explicit format override required):
[]
= ["package[name=brel].version"]
[]
= "toml"
Changelog Generation (git-cliff)
brel initgenerates a workflow that runsorhun/git-cliff-action@v4by default.- Configure changelog behavior with
[release_pr.changelog]:enabled(defaulttrue)output_file(default"CHANGELOG.md")
- Generated workflow behavior:
- computes
next-versionfirst viabrel next-version - runs
git-cliffonly when a next version exists - passes
--unreleased --tag <rendered-tag-template>so the newest changelog section is versioned instead of[unreleased]
- computes
- If changelog generation is enabled,
brel release-prstagesoutput_filein the release commit when that file exists. - Disable changelog generation:
[]
= false
brel initdoes not create or managecliff.toml; keep that file in your repository if you want customgit-cliffrules.
Branch / Commit / PR Behavior
- Default branch pattern:
brel/release/v{{version}}- Only
{{version}}is supported as a token.
- Only
release_pr.tagging.tag_templatecontrols rendered release tags (defaultv{version}).tag_templateaccepts{version}and legacy{{version}}(normalized to{version}).tag_templatemust include exactly one version token.
- Commit message:
chore(release): <rendered-tag> - PR title:
Release <rendered-tag> - Commit author defaults to:
name = "brel[bot]"email = "brel[bot]@users.noreply.github.com"
- Push strategy:
--force-with-leasetoorigin.
For PRs:
brelusesgh pr listto find an open managed release PR.- If found, it updates that PR (continuity wins over recomputing branch name).
- If not found, it creates a new PR.
Tagging on Merge
- Optional config:
[release_pr.tagging] enabled = true(defaultfalse). - Tag format config:
[release_pr.tagging] tag_template = "v{version}"(default shown). - When enabled, the generated workflow listens for merged pull requests into the configured default branch.
- If the merged PR is managed by
breland titledRelease <rendered-tag>, the workflow validates it againsttag_template, then creates and pushes that tag when it does not already exist. - Create repository secret
BREL_TAG_PUSH_TOKENbefore using tagging-on-merge.- Use a PAT that can push tags to the repository (fine-grained PAT with
Contents: Read and write). - This is required because pushes done with
GITHUB_TOKENdo not trigger downstream tag-push workflows.
- Use a PAT that can push tags to the repository (fine-grained PAT with
brel initprints this secret requirement whenever tagging is enabled.
PR Body Templates
If release_pr.pr_template_file is set, brel renders that Handlebars template.
Available variables:
versiontagbase_branchrelease_branchcommits(array of{ sha_short, subject })
Important: include this marker in your template so future runs can detect and update the same PR:
<!-- managed-by: brel -->
If rendering fails, brel release-pr exits with an error.
Typical Usage
Generate workflow once:
Run release locally:
GH_TOKEN=...
Run with explicit config:
Validate config:
Preview the next release version: