-
Notifications
You must be signed in to change notification settings - Fork 653
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
Save variables as environment variables #2721
Comments
It's not well documented, but GitVersion already exposes all version variables as environment variables in the form |
Thank you, I must be missing something as I tried that without success. I call version.exe as a Visual Studio prebuild event and then call I've not been able to access the variable as %GitVersion_FullSemVer%. |
I see. itself, that's done by the different build tasks (as how environment variables are set differs from build server to build server). You can see how it's done in AzDO here: GitVersion/src/GitVersion.Core/BuildAgents/AzurePipelines.cs Lines 20 to 27 in dca8008
#2722 seeks to improve the documentation in this area. |
Well I was actually thinking of the host OS environment variables. That looks like a build system's variables/parameters. |
GitVersion does write OS environment variables, but I don't know AzDO well enough to say for certain that's what the linked code does. I can, however, say for certain that the GitHub Actions integration does it as per the following lines of code:
GitVersion/src/GitVersion.Core/BuildAgents/GitHubActions.cs Lines 51 to 59 in dca8008
In GitHub Actions, evironment variables are written to a file whose path is given in the environment variable |
This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs. Thank you for your contributions. |
When writing scripts to customise version formatting to our needs, it has been difficult to access GitVersion variables. It would be easier if GitVersion variable(s) could optionally be exposed as environment variables.
Detailed Description
When using a batch file (say) or an MsBuild task (target file) to customise version formatting to our needs we need to read the GitVersion variable from a file (this may be mutually exclusive to using command line
output
option ofbuildsystem
).If we could, by configuration, nominate all or some variables to be made available as system variables (current session only) then we could access those in many languages including even (shock) a batch file.
Context
Reduce dev time to use the tool.
Possible Implementation
Another retrospective solution. Done by awful means.
The text was updated successfully, but these errors were encountered: