Skip to content
| Marketplace
Sign in
Azure DevOps>Azure Pipelines>Version from git tag
Version from git tag

Version from git tag

BjarteB

|
46 installs
| (0) | Free
Tool to get the version name from the current branch
Get it free

Version from git tag extracts the version number from the tag name when a build is triggered from a tag. Versionnumbers must conform with the semver standard.

Valid tags are tags/v1.0.0, tags/1.0.0, tags/1.0, tags/1

Input parameters

failOnInvalidVersion A boolean flag indicating that the task should fail when no valid version detected. Default false

Output variables

versionIsValid A true/false string value indicating that the task was able to extract the version

version The full semver version number. If the tag is tags/1.2 this will be '1.2.0' Empty when no valid version set

versionMajor The major version number Empty when no valid version set

versionMinor The minor version number Empty when no valid version set

versionPatch The patch version number Empty when no valid version set

Example

- task: bjartebore.git-tag-version.version-task.git-tag-version@0
  displayName: 'Extract version from tag'
  name: semver
  inputs:
  failOnInvalidVersion: false

- bash: |
    echo "versionIsValid: $(semver.versionIsValid)"
    echo "version: $(semver.version)"
    echo "versionMajor: $(semver.versionMajor)"
    echo "versionMinor: $(semver.versionMinor)"
    echo "versionPatch: $(semver.versionPatch)"

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft