Awesome
:mechanical_arm: hooks-exec
This plugin allows to execute custom scripts during the semantic-release process.
Usage
Use this plugin by enabling it via --hooks exec
.
Configuration
There are two possible scripts that can be executed during the release process: (i) the success script, if the release was successful, and (ii) the no release script, if the was not created for a specific reason.
The scripts are configured via the --hooks-opt exec_on_success="echo v{{.NewRelease.Version}} "
and --hooks-opt exec_on_no_release="echo {{.Reason}}"
flags. Additionally, they .semrelrc
file can be used to configure the scripts:
{
"plugins": {
"hooks": {
"names": [
"exec"
],
"options": {
"exec_on_success": "echo v{{.PrevRelease.Version}} '->' v{{.NewRelease.Version}}",
"exec_on_no_release": "echo {{.Reason}}: {{.Message}}"
}
}
}
}
Success script configuration
The success script configuration accepts Go templates with the following variables:
{{.PrevRelease.Version}}
: The previous release version.{{.NewRelease.Version}}
: The new release version.{{.Changelog}}
: The release changelog.{{.Commits}}
: The commits between the previous and the new release.{{.RepoInfo}}
: The repository information.
A more detailed documentation about the available variables can be found here.
No release script configuration
The no release script configuration also accepts Go templates with the following variables:
{{.Reason}}
: The reason why no release was created. One of{{.Message}}
: The message why no release was created
A more detailed documentation about the available variables can be found here.
Licence
Copyright © 2023 Christoph Witzko