pwsh environment variables aren't propagated
for example in the following token is passed to deploy but release_title is not
before_deploy:
- pwsh: $env:release_title="iricdev $(get-date -AsUTC -Format o)"
- ps: $env:token=$env:scharlton2_access_token
deploy:
- provider: GitHub
tag: LATEST
release: $(release_title)
description: 'Test release'
auth_token: $(token)
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 03 Apr, 2022 04:15 AM
That's because
pwsh
scripts in Windows builds run in a separate process. However, in pwsh script you can put environment variables to a machine level and then in the following ps script read it from there and set to a local env variable.2 Posted by charlton on 03 Apr, 2022 08:06 PM
Okay, I didn't know about the different scopes of environment variables. I tried to escape the square brackets, but I couldn't get it to work. I had to resort to this (for the pwsh line):
Is there an easier way?
Thanks
Support Staff 3 Posted by Feodor Fitsner on 03 Apr, 2022 11:41 PM
I've got it working: https://gist.github.com/FeodorFitsner/bad29768ea24f8bdaae28677ba49fdfc
Test build: https://ci.appveyor.com/project/FeodorFitsner/simple-console/builds...
4 Posted by charlton on 04 Apr, 2022 03:26 PM
Sorry, my question was is there a way to do it without the 'if ($true) {'.
When I tried the following it didn't like the square bracket as the first character.
and I tried to escape using backslashes:
but neither worked.
I just wondered if there was another way to escape it.
Thanks
Support Staff 5 Posted by Feodor Fitsner on 04 Apr, 2022 03:48 PM
Sure, I thought that condition was a placeholder for some logic :)
Try this one please: https://gist.githubusercontent.com/FeodorFitsner/bad29768ea24f8bdaa...
6 Posted by charlton on 04 Apr, 2022 10:53 PM
Thanks
charlton closed this discussion on 04 Apr, 2022 10:53 PM.