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

Explicit mention of how GitVersion exposes environment variables #2722

Merged
merged 1 commit into from
Jun 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions docs/input/docs/reference/build-servers/index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,41 @@ Description: Details on GitVersion's Build Server support

@Html.Partial("_ChildPages")

<p>
When the <code>gitVersion</code> executable is run with the
<code>/output buildserver</code> flag instead of outputting JSON it will
export variables to the current build server.
</p>
<h2>Build Server Variables</h2>

<p>
For instance if you are running in TeamCity after you run
When the <code>gitVersion</code> executable is run with the
<code>/output buildserver</code> flag instead of outputting JSON, it will
export its <a href="/docs/reference/variables">version variables</a> to the
current build server as build-server native variables. For instance if you
are running in TeamCity after you run
<code>gitversion /output buildserver</code> you will have the
<code>%system.GitVersion.SemVer%</code> variable available for you to use
in the rest of the build configuration.
</p>

<h2>MSBuild Properties</h2>

<p>
When running in MSBuild either from the
<a href="/docs/usage/msbuild">MSBuild Task</a> or
by using the <code>/proj myproject.sln</code> parameter, GitVersion will
make the MSBuild variables available in the format
<code>$(GitVersion_SemVer)`</code>
<a href="/docs/usage/msbuild">MSBuild Task</a> or by using
<code>/proj myproject.sln</code> parameter, GitVersion will make its
<a href="/docs/reference/variables">version variables</a> available as
MSBuild properties in the format <code>$(GitVersion_SemVer)</code>.
</p>

<h2>Environment Variables</h2>

<p>
When executed within one of the supported build servers mentioned above,
GitVersion will also expose the <a href="/docs/reference/variables">version
variables</a> as <strong>environment variables</strong>, in the format
<code>GitVersion_SemVer</code> (and in some circumstances, as
<code>GitVersion.SemVer</code>).
</p>

<h2>Normalization</h2>

<p>
The standard <code>gitversion</code> executable normalize the branches if
there is a build server detected. This behavior can be disabled with the
Expand Down
7 changes: 7 additions & 0 deletions docs/input/docs/reference/variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,10 @@ Each property of the above JSON document is described in the below table.
| `CommitsSinceVersionSourcePadded` | The `CommitsSinceVersionSource` padded with `0` up to 4 digits. |
| `CommitDate` | The ISO-8601 formatted date of the commit identified by `Sha`. |
| `UncommittedChanges` | The number of uncommitted changes present in the repository. |

Depending on how and in which context GitVersion is executed (for instance
within a [supported build server][build-servers]), the above version variables
may be exposed automatically as **environment variables** in the format
`GitVersion_FullSemVer`.

[build-servers]: ./build-servers/