exec
exec copied to clipboard
Simple Script does nothing
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
"@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 thesemantic-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.
I had to add bash to the script command:
"plugins": [ [ "@semantic-release/exec", { "verifyConditionsCmd": "bash ./test.sh ${nextRelease.version}" } ] ],
I'm also having this issue. it's causing quite a bit of pain.
Why no feedback on this? it's almost one year since this issue has been opened....I'm also having the same issue here
Did you all try to make the bash script as an executable?
- Adding a shebang
#!/bin/bash
at the top of the file. - Changing permissions:
chmod +x myScript.sh