Save variables as environment variables
See original GitHub issueWhen 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 of buildsystem
).
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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
I see.
gitversion.exe
should set environment variables if it detects that it’s running within a supported build server.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:
https://github.com/GitTools/GitVersion/blob/dca800837bb34e3cda8be4fb28b0bc72964e656f/src/GitVersion.Core/BuildAgents/AzurePipelines.cs#L20-L27
#2722 seeks to improve the documentation in this area.
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.