1.2.1 • Published 9 months ago

@lets-release/exec v1.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@lets-release/exec

lets-release plugin for executing custom shell commands.

StepDescription
findPackagesExecute a shell command to find packages in the workspace.
verifyConditionsExecute a shell command to verify if the release should happen.
analyzeCommitsExecute a shell command to determine the type of release.
verifyReleaseExecute a shell command to verify a release that was determined before and is about to be published.
generateNotesExecute a shell command to generate the release note.
addChannelsExecute a shell command to add channels to merge releases.
prepareExecute a shell command to prepare the release.
publishExecute a shell command to publish the release.
successExecute a shell command to notify of a new release.
failExecute a shell command to notify of a failed release.

Usage

The plugin can be configured in the lets-release configuration file:

{
  "plugins": [
    "@lets-release/commit-analyzer",
    "@lets-release/release-notes-generator",
    ["@lets-release/exec", {
      "verifyConditionsCmd": "./verify.sh",
      "publishCmd": "./publish.sh ${nextRelease.version} ${branch.name} ${commits.length} ${Date.now()}"
    }],
  ]
}

In this example:

  • the shell command ./verify.sh will be executed during the verifyConditions step
  • the shell command ./publish.sh 1.0.0 master 3 870668040000 (for the release of version 1.0.0 from branch master with 3 commits on August 4th, 1997 at 2:14 AM) will be executed on the publish step

Note: It is required to define a plugin for the analyzeCommits step. If no analyzeCommitsCmd is defined the plugin @lets-release/commit-analyzer must be defined in the plugins list.

Configuration

Options

OptionsDescription
findPackagesCmdThe shell command to be executed during the findPackages step. See findPackagesCmd.
verifyConditionsCmdThe shell command to be executed during the verifyConditions step. See verifyConditionsCmd.
analyzeCommitsCmdThe shell command to be executed during the analyzeCommits step. See analyzeCommitsCmd.
verifyReleaseCmdThe shell command to be executed during the verifyRelease step. See verifyReleaseCmd.
generateNotesCmdThe shell command to be executed during the generateNotes step. See generateNotesCmd.
addChannelsCmdThe shell command to be executed during the addChannels step. See addChannelsCmd.
prepareCmdThe shell command to be executed during the prepare step. See prepareCmd.
publishCmdThe shell command to be executed during the publish step. See publishCmd.
successCmdThe shell command to be executed during the success step. See successCmd.
failCmdThe shell command to be executed during the fail step. See failCmd.
shellThe shell to use to run the command. See execa.
cwdThe path to use as current working directory when executing the shell commands. This path is relative to the path from which lets-release is running. For example if lets-release runs from /my-project and cwd is set to buildScripts then the shell command will be executed from /my-project/buildScripts

Each shell command is generated with Lodash template. All the objects passed to the lets-release plugins are available as template options.

findPackagesCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutThe packages should be written to stdout as stringified JSON (for example {"name": "pkg", "path": "/path/to/pkg"}). If the command write non-stringified JSON to stdout, no packages will be returned.
stderrCan be used for logging.

verifyConditionsCmd

Command propertyDescription
exit code0 if the verification is successful, or any other exit code otherwise.
stdoutOnly the reason for the verification failure should be written.
stderrCan be used for logging.

analyzeCommitsCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutOnly the release type (major, minor or patch etc.) should be written to stdout. If no release has to be done the command must not write to stdout.
stderrCan be used for logging.

verifyReleaseCmd

Command propertyDescription
exit code0 if the verification is successful, or any other exit code otherwise.
stdoutOnly the reason for the verification failure should be written to stdout.
stderrCan be used for logging.

generateNotesCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutOnly the release notes should be written to stdout.
stderrCan be used for logging.

prepareCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutCan be used for logging.
stderrCan be used for logging.

addChannelsCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutThe release information can be written to stdout as stringified JSON (for example {"name": "Release name", "url": "http://url/release/1.0.0"}). If the command writes non-parseable JSON to stdout, no release information will be returned.
stderrCan be used for logging.

publishCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutThe release information can be written to stdout as stringified JSON (for example {"name": "Release name", "url": "http://url/release/1.0.0"}). If the command writes non-parseable JSON to stdout, no release information will be returned.
stderrCan be used for logging.

successCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutCan be used for logging.
stderrCan be used for logging.

failCmd

Command propertyDescription
exit codeAny non 0 code is considered as an unexpected error and will stop the lets-release execution with an error.
stdoutCan be used for logging.
stderrCan be used for logging.
1.2.1

9 months ago

1.2.0

10 months ago

1.1.0

10 months ago

1.0.1

11 months ago

1.0.0

11 months ago