Find out how to use the gitversion/setup action using the examples below.
The examples use version 3.1.0 of the GitVersion Setup action. It is recommended to use the latest released version in your own workflows.
The Setup GitVersion action accepts the following inputs:
versionSpec:
description: Required version in the form of 6.x or exact version like 6.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
In order for the gitversion to properly work you need to clone the repository with the entire history:
steps:
-
name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
Install the latest GitVersion 6 version.
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.0.x'
Install GitVersion 6.0.0.
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.0.0'
Install the latest GitVersion 6 pre-release version. For example 6.0.0-beta.6.
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.0.x'
includePrerelease: true
Install the latest GitVersion 6 version even it there is a cached version matching the versionSpec.
steps:
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: '6.0.x'
preferLatestVersion: true