Skip to content

Latest commit

 

History

History
90 lines (69 loc) · 1.91 KB

usage-examples.md

File metadata and controls

90 lines (69 loc) · 1.91 KB

Setup GitVersion Task (gitversion/setup) Usage Examples

Find out how to use the gitversion/setup task using the examples below.

The examples use the latest 0.x version of the GitVersion Setup task. It is recommended to use the latest released version in your own pipelines.

Inputs

The Setup GitVersion task accepts the following inputs:

versionSpec:
  description: Required version in the form of 5.x or exact version like 5.0.0.
  required: true
  default: ''
includePrerelease:
  description: Include pre-release versions when matching a version.
  required: false
  default: false
ignoreFailedSources:
  description: Treat package source failures as warnings.
  required: false
  default: false
preferLatestVersion:
  description: Prefer to download the latest version matching the versionSpec, even if there is a local cached version.
  required: false
  default: 'false'

Usage examples

In order for the gitversion to properly work you need to clone the repository with the entire history:

steps:
  - checkout: self
    fetchDepth: 0

Example 1

Install the latest GitVersion 5 version.

steps:
  - task: gitversion/setup@0
    displayName: Install GitVersion
    inputs:
      versionSpec: '5.x'

Example 2

Install GitVersion 5.5.0.

steps:
  - task: gitversion/setup@0
    displayName: Install GitVersion
    inputs:
      versionSpec: '5.5.0'

Example 3

Install the latest GitVersion 6 pre-release version. For example 6.0.0-beta1.1.

steps:
  - task: gitversion/setup@0
    displayName: Install GitVersion
    inputs:
      versionSpec: '6.x'
      includePrerelease: true

Example 4

Install the latest GitVersion 5 version even it there is a cached version matching the versionSpec.

steps:
  - task: gitversion/setup@0
    displayName: Install GitVersion
    inputs:
      versionSpec: '5.x'
      preferLatestVersion: true