Zum Inhalt springen

Configuration

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

All semrel behavior is controlled by a single config file in the root of your repository. You can specify a different path with --config.

semrel auto-discovers the config file in this order:

FileFormat
.semrel.yaml / .semrel.ymlYAML
.semrel.tomlTOML
.semrel.jsonJSON

YAML uses camelCase for some keys (e.g. tagPrefix). TOML and JSON always use snake_case (e.g. tag_prefix).

tagPrefix: v
branches:
- name: main
- name: "*.x"
maintenance: true
- name: next
prerelease: beta
rules:
- type: feat
bump: minor
- type: fix
bump: patch
- type: perf
bump: patch
- type: revert
bump: patch
commit_changelog: true
tag_exists_strategy: update-changelog
version_ceiling: "1.0.0"
ceiling_strategy: clamp
plugins:
- uses: github-actions
phase: condition
- uses: github
phase: release
args:
token: ${{ env.GITHUB_TOKEN }}
owner: MyOrg
repo: my-repo
- uses: gobinary
phase: pre-tag
args:
file: internal/version/version.go
var_name: Version
- uses: slack
args:
webhook_url: ${{ env.SLACK_WEBHOOK }}

The prefix prepended to the version number when creating git tags.

tagPrefix: v # creates tags like v1.2.3 (default)
tagPrefix: "" # creates tags like 1.2.3
ValueDefaultDescription
any stringvPrepended to every tag semrel creates

A list of branches from which releases can be made. Commits on unlisted branches are ignored.

branches:
- name: main
- name: "*.x"
maintenance: true
- name: next
prerelease: beta
FieldTypeDefaultDescription
namestringBranch name or glob pattern (e.g. main, "*.x", release/*)
prereleasestringPre-release identifier appended to the version (e.g. beta1.0.0-beta.1)
maintenanceboolfalseRestricts this branch to patch-only bumps. Also auto-detected from N.x / N.M.x patterns

Maps conventional commit types to semver bump levels. If omitted, semrel uses the built-in defaults.

rules:
- type: feat
bump: minor
- type: fix
bump: patch
- type: perf
bump: patch
- type: revert
bump: patch
FieldTypeRequiredDescription
typestringyesConventional commit type (e.g. feat, fix, perf)
bumpstringyesOne of major, minor, patch

When rules: is absent, semrel uses:

TypeBump
featminor
fixpatch
perfpatch
revertpatch

Commit types not listed in rules produce no release.

Controls whether semrel commits CHANGELOG.md back to the repository before creating the release tag.

commit_changelog: true # default
ValueBehaviour
true (default)semrel writes CHANGELOG.md, commits it as chore(changelog): update for vX.Y.Z [skip ci], then creates the tag on that commit
falsesemrel writes CHANGELOG.md locally but does not commit it (useful if you manage the changelog externally)

Controls what semrel does when the computed next version tag already exists locally.

tag_exists_strategy: update-changelog # default
StrategyBehaviour
update-changelog (default)Updates and commits CHANGELOG.md for the existing version, then exits without error. Idempotent — useful for repair runs.
skipExits silently without any changes.
errorExits with a non-zero code. Use this if you want strict one-shot pipelines.

Example scenario: you manually created v0.1.0 to bootstrap the project. The next pipeline run detects the tag exists and, with the default strategy, regenerates and commits the changelog for that version — no duplicate release is created.

Prevents semrel from releasing at or above this version. Useful for keeping a project below 1.0.0 until you deliberately promote it to stable.

version_ceiling: "1.0.0"
ceiling_strategy: clamp
ValueEffect
Not setNo ceiling — semrel bumps freely
"1.0.0"Releases are never >= 1.0.0

Controls what happens when the calculated next version would reach or exceed version_ceiling.

StrategyBehaviour
clampDowngrades the bump (major → minor → patch) until the version stays below the ceiling. Logs a warning.
skipDoes nothing — prints a notice and exits without releasing.
errorExits with a non-zero code so the pipeline fails explicitly.

Example: current 0.9.5, breaking change commit, ceiling 1.0.0

  • clamp → releases 0.9.6 (downgraded to patch)
  • skip → no release, exit 0
  • error → no release, exit 1

To promote past the ceiling, remove or raise version_ceiling in your config file and commit.

An ordered list of plugins to load for the release pipeline.

FieldTypeRequiredDescription
usesstringyes*Plugin type or install name. semrel resolves to semrel-plugin-<uses>
namestringnoOptional instance identifier (useful when the same plugin appears multiple times)
pathstringnoExplicit path to a plugin binary (overrides uses resolution)
argsmapnoArbitrary key-value pairs passed to the plugin as SEMREL_PLUGIN_* environment variables
phasestringnoWhen to run: condition, pre-tag, or release (default)

*Either uses or path must be set.

PhaseWhen it runsTypical use
conditionAfter config load, before any commit analysis or tag creationgithub-actions, gitlab-ci — abort if environment is wrong
pre-tagAfter version calculation and changelog write, before the git tag is createdgobinary — update version file and commit so the tagged source contains the real version
releaseAfter the tag is created (default)github, hook-slack, updater-npm — publish and notify
plugins:
# Gate: abort if not running in GitHub Actions
- uses: github-actions
phase: condition
# Pre-tag: update Go version variable before tagging
- uses: gobinary
phase: pre-tag
args:
file: internal/version/version.go
var_name: Version
# Release: create GitHub release with changelog
- uses: github
phase: release # default, can be omitted
args:
token: ${{ env.GITHUB_TOKEN }}
owner: MyOrg
repo: my-repo
# Hook: notify Slack after release
- uses: slack
args:
webhook_url: ${{ env.SLACK_WEBHOOK }}

If path: is omitted, semrel resolves plugins in this order:

  1. ~/.semrel/plugins/semrel-plugin-<uses>
  2. semrel-plugin-<uses> from $PATH

Use path: when you want to pin a specific local binary instead of the default discovery flow.

Every key in args: is exposed to the plugin process as an environment variable prefixed with SEMREL_PLUGIN_.

plugins:
- uses: github
args:
token: ${{ env.GITHUB_TOKEN }}
owner: MyOrg
repo: my-repo

The plugin receives:

Config keyEnvironment variable
tokenSEMREL_PLUGIN_TOKEN
ownerSEMREL_PLUGIN_OWNER
repoSEMREL_PLUGIN_REPO

Plugins also receive release context through standard environment variables:

VariableDescription
SEMREL_CURRENT_VERSIONThe version before this release
SEMREL_NEXT_VERSIONThe new version being released
SEMREL_TAG_NAMEThe full tag name including prefix (e.g. v1.2.3)
SEMREL_CHANGELOGPath to the written CHANGELOG.md file
SEMREL_DRY_RUNtrue if semrel was invoked with --dry-run

semrel plugins are plain executables launched as subprocesses. They do not use gRPC.


The semrel registry serves JSON Schema documents for .semrel.yaml and every plugin. Adding a $schema comment enables inline validation and autocompletion in VS Code, JetBrains IDEs, Neovim (with LSP), and any other editor that supports yaml-language-server.

Add the $schema comment as the first line of your .semrel.yaml:

# yaml-language-server: $schema=https://registry.semrel.io/schemas/core/v1.json
schemaVersion: 1
tagPrefix: "v"
plugins:
- uses: analyzer-conventional
- uses: generator-changelog-md
- uses: provider-github

Your editor will now flag unknown keys, warn about missing required fields, and offer autocomplete for all known options.

Each plugin’s args: block can be validated independently. Place the schema comment directly above the args: key:

# yaml-language-server: $schema=https://registry.semrel.io/schemas/core/v1.json
plugins:
- uses: provider-github
# yaml-language-server: $schema=https://registry.semrel.io/schemas/plugins/provider-github/latest.json
args:
token: ${{ env.GITHUB_TOKEN }}
owner: MyOrg
repo: my-repo
ResourceURL
Core confighttps://registry.semrel.io/schemas/core/v1.json
Plugin (by name)https://registry.semrel.io/schemas/plugins/{name}/v1.json
Plugin (latest)https://registry.semrel.io/schemas/plugins/{name}/latest.json
Namespaced pluginhttps://registry.semrel.io/schemas/plugins/@semrel/{name}/v1.json

latest.json always redirects (HTTP 301) to the newest stable schema version.

If you run a private semrel-registry instance, replace registry.semrel.io with your own base URL:

# yaml-language-server: $schema=https://my-registry.example.com/schemas/core/v1.json

You can also validate your config against the published schema using semrel config validate:

Terminal window
semrel config validate
# ✓ Config is valid (schema version 1)

See semrel config for the full command reference.