semantic-release plugin to execute custom shell commands.
- Check semantic-release steps
- Semantic release steps / implemented by the plugin
semantic-release/exec
Step | Description |
---|---|
verifyConditions |
Execute a shell command -- to -- verify if the release should happen. |
analyzeCommits |
Execute a shell command -- to -- determine the type of release. |
verifyRelease |
Execute a shell command -- to -- verifying a release that was determined before and is about to be published. |
generateNotes |
Execute a shell command -- to -- generate the release note. |
prepare |
Execute a shell command -- to -- prepare the release. |
publish |
Execute a shell command -- to -- publish the release. |
success |
Execute a shell command -- to -- notify of a new release. |
fail |
Execute a shell command -- to -- notify of a failed release. |
$ npm install @semantic-release/exec -D
- Check semantic-release configuration file
- Example
{ "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", ["@semantic-release/exec", { "verifyConditionsCmd": "./verify.sh", "publishCmd": "./publish.sh ${nextRelease.version} ${branch.name} ${commits.length} ${Date.now()}" }], ] }
./verify.sh
will be executed on the verifyConditions./publish.sh 1.0.0 master 3 870668040000
(for the release of version1.0.0
from branchmaster
with3
commits onAugust 4th, 1997 at 2:14 AM
) will be executed on the publish
Options | Description |
---|---|
verifyConditionsCmd |
The shell command to execute during the verifyConditions step. See verifyConditionsCmd. |
analyzeCommitsCmd |
The shell command to execute during the analyzeCommits step. See analyzeCommitsCmd. |
verifyReleaseCmd |
The shell command to execute during the verifyRelease step. See verifyReleaseCmd. |
generateNotesCmd |
The shell command to execute during the generateNotes step. See generateNotesCmd. |
prepareCmd |
The shell command to execute during the prepare step. See prepareCmd. |
addChannelCmd |
The shell command to execute during the addChannel step. See addChannelCmd. |
publishCmd |
The shell command to execute during the publish step. See publishCmd. |
successCmd |
The shell command to execute during the success step. See successCmd. |
failCmd |
The shell command to execute during the fail step. See failCmd. |
shell |
The shell to use to run the command. See execa#shell. |
execCwd |
The path to use as current working directory when executing the shell commands. Relative to the path from which semantic-release is running. Example: if semantic-release runs from /my-project and execCwd is set to buildScripts then the shell command will be executed from /my-project/buildScripts |
- Shell commands are generated with Lodash template
- All the objects passed to the semantic-release plugins -- are available as -- template options.
- Shell command to verify if the release should happen.
Command property | Description |
---|---|
exit code |
0 if the verification is successful, or any other exit code otherwise. |
stdout |
Write only the reason for the verification to fail. |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
Only the release type (major , minor or patch etc..) can be written to stdout . If no release has to be done the command must not write to stdout . |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
0 if the verification is successful, or any other exit code otherwise. |
stdout |
Only the reason for the verification to fail can be written to stdout . |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
Only the release note must be written to stdout . |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
Can be used for logging. |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
The release information can be written to stdout as parseable JSON (Example {"name": "Release name", "url": "http://url/release/1.0.0"} ). If the command write non parseable JSON to stdout no release information will be returned. |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
The release information can be written to stdout as parseable JSON (Example {"name": "Release name", "url": "http://url/release/1.0.0"} ). If the command write non parseable JSON to stdout no release information will be returned. |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
Common uses for logging. |
stderr |
Common uses for logging. |
Command property | Description |
---|---|
exit code |
If != 0 == unexpected error, -> semantic-release execution is stopped with an error. |
stdout |
Common uses for logging. |
stderr |
Common uses for logging. |