This plugin allows to execute custom scripts during the semantic-release process.
Use this plugin by enabling it via --hooks exec.
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-opts exec_on_success="echo v{{.NewRelease.Version}} " and --hooks-opts exec_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}}" } } } } 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.
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.
Copyright © 2023 Christoph Witzko