exec icon indicating copy to clipboard operation
exec copied to clipboard

Simple Script does nothing

Open oarm14 opened this issue 3 years ago • 5 comments

I am trying to understand how/where the scripts run. I've got a very simple shell script for testing that I want to run during any step. I've tried several.

Below is my releaserc file as well as the contents of the script. I can see where the output of semantic release shows where it runs but there is never any output from the script. No output from the echo command or version.txt is ever created. Also, notice that I do not have "./" in front of my version.sh because this runs on a windows machine and errors out when it is included. Any tips are appreciated.

releaserc

{
"branches": ["master"],
"plugins": [
    "@semantic-release/commit-analyzer",
    "@semantic-release/release-notes-generator",
    "@semantic-release/changelog",
    ["@semantic-release/exec", {
      "publishCmd": "version.sh ${nextRelease.version}"
    }],
    ["@semantic-release/git", {
      "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
    }]
  
    ]
}

Shell script
#!/bin/bash

VERSION=$1
echo "This is the version from semantic release"
echo $VERSION >> version.txt

oarm14 avatar Apr 27 '21 14:04 oarm14

    "@semantic-release/exec": "^5.0.0",
    "@semantic-release/git": "^9.0.0",
    "semantic-release": "^17.4.2",

Same issue on linux machines, scripts do not seem to work in any way:

  • Logs are gobbled up by the package, even in debug mode from the semantic-release command.
  • Expected file output are missing.
  • Exit codes 1 in the script are completely ignored and the plugin proceeds as if nothing happened, which is most likely the case.

Tested with trivial bash and .js scripts the like of "print AAAAAA in package.json".

Nothing.

louis-vinchon avatar May 10 '21 13:05 louis-vinchon

I had to add bash to the script command:

"plugins": [ [ "@semantic-release/exec", { "verifyConditionsCmd": "bash ./test.sh ${nextRelease.version}" } ] ],

mrjeffwagner avatar Jun 03 '21 13:06 mrjeffwagner

I'm also having this issue. it's causing quite a bit of pain.

jamesloosli avatar Jun 29 '21 21:06 jamesloosli

Why no feedback on this? it's almost one year since this issue has been opened....I'm also having the same issue here

dgroh avatar Jan 27 '22 17:01 dgroh

Did you all try to make the bash script as an executable?

  1. Adding a shebang #!/bin/bash at the top of the file.
  2. Changing permissions: chmod +x myScript.sh

sag1v avatar Apr 29 '23 19:04 sag1v