Skip to content

Commit

Permalink
Explicit mention of how GitVersion exposes environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
asbjornu authored and arturcic committed Jun 11, 2021
1 parent dca8008 commit 73a5938
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
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/

0 comments on commit 73a5938

Please sign in to comment.