version_bump/plugins/exec
The exec plugin — semantic-release’s escape hatch.
Instead of implementing a hook in Gleam, the user supplies a shell command
for any lifecycle step via PluginSpec.options. Each option key maps to one
hook; when present, that hook runs the command through sh -c in the
project’s cwd:
verifyConditionsCmd-> verify_conditionsanalyzeCommitsCmd-> analyze_commitsverifyReleaseCmd-> verify_releasegenerateNotesCmd-> generate_notesprepareCmd-> preparepublishCmd-> publishsuccessCmd-> successfailCmd-> fail
Hook semantics:
- analyze_commits: the trimmed stdout is parsed into a
ReleaseType(“major”/“minor”/“patch” ->Some(..), empty / anything else ->None). - generate_notes: the trimmed stdout becomes the release notes.
- publish: currently signals “not handled” (
None) on success, since the command produces no structuredRelease. - everything else: a non-zero exit aborts the pipeline with a
PluginError.
Values
pub fn parse_release_type(
stdout: String,
) -> option.Option(semver.ReleaseType)
Parse the trimmed stdout of an analyzeCommitsCmd into a ReleaseType.
PURE. Matches semantic-release/exec semantics: the command prints the bump
type on stdout. "major"/"minor"/"patch" (case-insensitive, surrounding
whitespace ignored) map to Some(..); empty output or any other value means
“no release” (None).
pub fn plugin() -> plugin.Plugin
Build the exec plugin, wiring every hook to the command runner. Each hook
looks up its corresponding option key at call time; if the key is absent the
hook is a no-op (it returns the neutral value for that step), so a single
plugin record can serve any subset of configured commands.