exec icon indicating copy to clipboard operation
exec copied to clipboard

When exactly is publishCmd run?

Open khaledosman opened this issue 5 years ago • 2 comments

I would like to run a command that uses the newly updated package.json version and write it into a file that is added to git to be included as part of the release commit, is it possible to do so with exec?

My use case is that I'm building a hybrid app where semantic-release would bump the package.json version, I would then like to use the new package.json version to update the native android & ios versions based on that and push that to git as part of the release commit, is that something I can accomplish with exec, or do I manually need to trigger my script after release as a separate commit?

I tried setting that as part of the publishCmd but it didn't work, it seems to be run either too early before the new package.json version is set or too late after the commit has already been made PS: npmPublish is set to false

khaledosman avatar Oct 20 '20 16:10 khaledosman

I think you should call the script which changes the files with @semantic-release/exec's prepareCmd, and then, include the files to be committed with @semantic-release/git, there is an option for adding custom files.

felipecrs avatar Dec 22 '20 15:12 felipecrs

It would be great to at least document when these hooks run (before or after) and what they run before or after. It's not clear what a "prepare" hook even hooks into, and when the hook fires (before or after).

EvanCarroll avatar Nov 08 '21 18:11 EvanCarroll