Skip to content

Commit 840a7fd

Browse files
authored
Merge pull request #3976 from arturcic/main
#3937 - Adapt docs to point to gittools/actions for GhA and AzDO
2 parents 268f8ff + 0dcab41 commit 840a7fd

File tree

10 files changed

+30
-173
lines changed

10 files changed

+30
-173
lines changed

docs/input/docs/reference/build-servers/azure-devops.md

Lines changed: 4 additions & 165 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,12 @@
22
Order: 20
33
Title: Azure DevOps
44
Description: |
5-
Details on the Azure DevOps or Team Foundation Server Build Pipeline support
6-
in GitVersion
5+
Details on the Azure DevOps Build Pipeline support in GitVersion
76
RedirectFrom: docs/build-server-support/build-server/azure-devops
87
---
8+
## Installation and usage
99

10-
## Basic Usage
11-
12-
In Azure DevOps Pipeline (the web based build system) you can call GitVersion
13-
either using the Command Line build step or install an extension / custom build
14-
step. The custom build step requires a one-time setup to import the GitVersion
15-
task into your TFS or Azure DevOps Pipeline instance.
10+
For Azure DevOps Services or Azure DevOps Server you can install the [GitTools Bundle](https://marketplace.visualstudio.com/items?itemName=gittools.gittools).
1611

1712
:::{.alert .alert-danger}
1813
**Important**
@@ -22,160 +17,4 @@ without it, Azure DevOps Pipelines will perform a shallow clone, which will caus
2217
See [the Azure DevOps documentation](https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/steps-checkout?view=azure-pipelines#shallow-fetch) for more information.
2318
:::
2419

25-
## Executing GitVersion
26-
27-
### Using GitVersion with the MSBuild Task NuGet Package
28-
29-
1. Add the [GitVersionTask](https://www.nuget.org/packages/GitVersionTask/)
30-
NuGet package to your projects.
31-
32-
See [MSBuild Task](/docs/usage/msbuild) for further instructions how to use
33-
the MS Build Task.
34-
35-
### Using GitVersion with the Command Line build step
36-
37-
1. Make sure to have GitVersion.exe under version control. There exists also a
38-
[Chocolatey package](https://chocolatey.org/packages/GitVersion.Portable) for
39-
installing GitVersion.exe on build agents.
40-
2. Add a Command Line build step to your build definition. You'll probably want
41-
to drag the task to be at or near the top to ensure it executes before your
42-
other build steps.
43-
3. Set the Tool parameter to `<pathToGitVersion>\GitVersion.exe`.
44-
4. Set the Arguments parameter to `/output buildserver /nofetch`.
45-
5. If you want the GitVersionTask to update AssemblyInfo files add
46-
`updateAssemblyInfo true` to the Arguments parameter.
47-
6. If you want to update the build number you need to send a
48-
[logging command](https://github.com/microsoft/azure-pipelines-tasks/blob/main/docs/authoring/commands.md)
49-
to TFS.
50-
51-
### Using the custom GitVersion build step
52-
53-
#### Installing
54-
55-
##### Installing the extension
56-
57-
For Visual Studio Team Service or TFS 2015 Update 2 or higher it is recommended
58-
to install the GitVersion extension:
59-
60-
1. Install the
61-
[GitVersion Extension](https://marketplace.visualstudio.com/items?itemName=gittools.usegitversion).
62-
63-
##### Manually installing/updating the custom build step
64-
65-
If you run TFS 2015 RTM or Update 1 or don't want to install the GitVersion
66-
extension you can install the build task manually:
67-
68-
1. Install the `tfx` command line tool as shown [here](https://github.com/microsoft/tfs-cli/blob/master/README.md#setup).
69-
2. For TFS 2015 On-Prem configure Basic Authentication in TFS as shown [here](https://github.com/microsoft/tfs-cli/blob/master/docs/configureBasicAuth.md).
70-
3. Download the GitVersion TFS build task from the latest release on the
71-
[GitVersion releases page](https://github.com/GitTools/GitVersion/releases) and
72-
unzip.
73-
4. Run `tfx login` as shown [here](https://github.com/microsoft/tfs-cli/blob/master/README.md#login).
74-
5. From the directory outside of where you unzipped the task, run
75-
`tfx build tasks upload --task-path .\GitVersionVsixTask --overwrite` where
76-
GitVersionVsixTask is the directory containing the files.
77-
6. It should successfully install.
78-
79-
#### Using the GitVersion custom build step
80-
81-
From a TFS build definition, select "Add a Step" and then in the Build category,
82-
choose GitVersion and click Add. You'll probably want to drag the task to be at
83-
or near the top to ensure it executes before your other build steps.
84-
85-
If you want the GitVersionTask to update AssemblyInfo files, check the box in
86-
the task configuration. For advanced usage, you can pass additional options to
87-
the GitVersion exe in the Additional arguments section.
88-
89-
The Azure DevOps Pipeline build step can update your build number with
90-
GitVersion variables. See below for details.
91-
92-
#### Using Pipelines yaml
93-
94-
Add the following yaml task and variable to your `azure-pipelines.yml` file:
95-
96-
```yml
97-
variables:
98-
GitVersion.SemVer: ''
99-
100-
steps:
101-
- task: UseGitVersion@5
102-
displayName: gitversion
103-
inputs:
104-
versionSpec: '5.x'
105-
updateAssemblyInfo: true
106-
```
107-
108-
You can now use the `GitVersion.SemVer` environment variable in any subsequent
109-
tasks to refer to the semantic version number for your build. For example, you
110-
can build your dotnet core application with a semantic version number like so:
111-
112-
```yml
113-
- task: DotNetCoreCLI@2
114-
displayName: Build
115-
inputs:
116-
command: build
117-
projects: '$(solution)'
118-
configuration: '$(buildConfiguration)'
119-
versioningScheme: byEnvVar
120-
versionEnvVar: 'GitVersion.SemVer'
121-
122-
```
123-
124-
## Running inside TFS
125-
126-
### Using the GitVersion Variables
127-
128-
GitVersion passes variables in the form of `GitVersion.*` (Eg:
129-
`GitVersion.Major`) to TFS Build and also writes `GITVERSION.*`
130-
(Eg: `GITVERSION.MAJOR`) environment variables that are available for any
131-
subsequent build step.
132-
133-
To use these variables you can just refer to them using the standard variable
134-
syntax. For instance `$(GitVersion.NuGetVersion)` in your nuget pack task to set
135-
the version number. Since update 1 there are no known limitations.
136-
137-
See [Variables](/docs/reference/variables) for an overview of available variables.
138-
139-
#### Using GitVersion variables in build name
140-
141-
To use GitVersion's variables in the build name, just add them in the form
142-
`$(GITVERSION_FullSemVer)` into the Build definition's build number string. Then
143-
just ensure GitVersion is called with `/output buildserver` and it will replace
144-
those variables with the calculated version. The TFS GitVersion Build Step
145-
(above) handles this too, so if you're already using that, there's nothing extra
146-
to configure.
147-
148-
If GitVersion does not find any substitutions it will just default to using `FullSemVer`
149-
150-
:::{.alert .alert-danger}
151-
**Important**
152-
153-
If you currently use `$(rev:.r)` in your build number, that won't
154-
work correctly if you
155-
use GitVersion variables as well due to the delayed expansion of the GitVersion
156-
vars. Instead, you might be able to use `$(GitVersion_BuildMetaData)` to achieve
157-
a similar result. See [Variables](/docs/reference/variables) for more info on the
158-
variables.
159-
:::
160-
161-
#### Known limitations
162-
163-
* If you are using on premises TFS, make sure you are using at least
164-
**TFS 2015 Update 1**, otherwise a few things will not work.
165-
* Installing the extension on an on premise TFS requires at least TFS 2015
166-
Update 2.
167-
* You need to make sure that all tags are fetched for the Git repository,
168-
otherwise you may end with wrong versions (e.g. `FullSemVer` like `1.2.0+5`
169-
instead of `1.2.0` for tagged releases) Just checking the `Clean Repository`
170-
check box in the build definition settings might not be enough since this will
171-
run a `git clean -fdx/reset --hard` without fetching all tags later. You can
172-
force deletion of the whole folder and a re-clone containing all tags by
173-
settings the variable `Build.Clean` to `all`. This will take more time during
174-
build but makes sure that all tags are fetched. In the future it is planned to
175-
allow using `git.exe` instead of current `libgit2sharp` for syncing the repos
176-
which might allow other possibilities to solve this issue. For details see this
177-
[GitHub issue](https://github.com/microsoft/azure-pipelines-tasks/issues/1218).
178-
* If running a build for a certain commit (through passing the commit SHA while
179-
queueing the build) all tags from the repository will be fetched, even the ones
180-
newer than the commit. This can lead to different version numbers while
181-
re-running historical builds.
20+
More information can be found at [gittools/actions](https://github.com/GitTools/actions/blob/main/docs/examples/azure/gitversion/index.md).

docs/input/docs/reference/build-servers/bitbucket-pipelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 35
2+
Order: 40
33
Title: BitBucket Pipelines
44
Description: Details on the Atlassian BitBucket Pipelines support in GitVersion
55
---

docs/input/docs/reference/build-servers/buildkite.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 40
2+
Order: 50
33
Title: Buildkite
44
Description: Details on the Buildkite support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/buildkite

docs/input/docs/reference/build-servers/continua.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 50
2+
Order: 60
33
Title: Continua CI
44
Description: Details on the Continua CI support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/continua
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
Order: 70
3+
Title: GitHunb Actions
4+
Description: |
5+
Details on the GitHunb Actions Workflow support in GitVersion
6+
---
7+
## Installation and usage
8+
9+
For GitHub Actions you can install the action from [GitTools Bundle](https://github.com/marketplace/actions/gittools).
10+
11+
:::{.alert .alert-danger}
12+
**Important**
13+
14+
You must disable shallow fetch by setting `fetch-depth: 0` in your `checkout` step;
15+
without it, GitHunb Actions might perform a shallow clone, which will cause GitVersion to display an error message.
16+
:::
17+
18+
More information can be found at [gittools/actions](https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/index.md).

docs/input/docs/reference/build-servers/gitlab.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 60
2+
Order: 80
33
Title: GitLab CI
44
Description: Details on the GitLab CI support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/gitlab

docs/input/docs/reference/build-servers/jenkins.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 70
2+
Order: 90
33
Title: Jenkins
44
Description: Details on the Jenkins support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/jenkins

docs/input/docs/reference/build-servers/myget.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 80
2+
Order: 100
33
Title: MyGet
44
Description: Details on the MyGet support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/myget

docs/input/docs/reference/build-servers/octopus-deploy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 90
2+
Order: 110
33
Title: Octopus Deploy
44
Description: Details on the Octopus Deploy support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/octopus-deploy

docs/input/docs/reference/build-servers/teamcity.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
Order: 100
2+
Order: 120
33
Title: TeamCity
44
Description: Details on the TeamCity support in GitVersion
55
RedirectFrom: docs/build-server-support/build-server/teamcity

0 commit comments

Comments
 (0)