Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing enviornment variables to the script #160

Open
nabebin opened this issue Apr 16, 2021 · 4 comments
Open

Passing enviornment variables to the script #160

nabebin opened this issue Apr 16, 2021 · 4 comments

Comments

@nabebin
Copy link

nabebin commented Apr 16, 2021

My "publishCmd" script needs environment variables to be set to run properly.
How could I pass them to the script?

I've tried the code below but with no success:

"@semantic-release/exec",
{
    "publishCmd": "node ./scripts/publish.js ${env.CI_ENVIRONMENT_VARIABLE}"
}
@konradekk
Copy link

konradekk commented May 25, 2021

see #117 for a possible solution; endorse that if it’s what you needed.

(it’s taking sooooo much time to assess that by the author, though! 😣)

@gliech
Copy link

gliech commented Aug 21, 2021

I had the same problem, and after some trial and error I noticed that I could simply access the environment through the process object. Adapting your example, it would look like this:

"@semantic-release/exec",
{
    "publishCmd": "node ./scripts/publish.js ${process.env.CI_ENVIRONMENT_VARIABLE}"
}

It would still be nice to see #117 merged into master though.

@konradekk
Copy link

konradekk commented Oct 17, 2021

this should work if you use release.config.js (and through cli in a natural manner). 🤔

the method you’ve indicated should almost certainly fail (as far as i remember) if you’ve settled for .releaserc or package.json (release key) for handling your configuration. i’m pretty sure this was the reason why i’d stumbled upon this in a first place… 😅

@konradekk
Copy link

@pvdlg bumping!

ctreatma added a commit to equinix-labs/metal-java that referenced this issue Oct 5, 2023
The most recent release job failed; I suspect this happened due to
this issue in `semantic-release/exec`:

 semantic-release/exec#160

This follows a suggestion in that issue to read the necessary variable
from `process.env` in an attempt to fix package publishing.
kennedykori added a commit to kennedykori/jutils that referenced this issue Jan 22, 2024
Since it is not possible to pass environment variables to process
spawned by the [semantic-release-exec-plugin](https://github.com/semantic-release/exec),
move publishing artifacts into an seperate process that runs after a release is made.

For more details regarding this issue, see [here](semantic-release/exec#160).
kennedykori added a commit to kennedykori/jutils that referenced this issue Jan 22, 2024
Since it is impossible to pass environment variables to processes
spawned by the [semantic-release-exec-plugin](https://github.com/semantic-release/exec),
move publishing artifacts into an seperate process that runs after a release is made.

For more details regarding this issue, see [here](semantic-release/exec#160).
kennedykori added a commit to kennedykori/jutils that referenced this issue Jan 22, 2024
Since it is impossible to pass environment variables to processes
spawned by the [semantic-release-exec-plugin](https://github.com/semantic-release/exec),
move publishing artifacts into an seperate process that runs after a release is made.

For more details regarding this issue, see [here](semantic-release/exec#160).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants