< Back

Step-SemanticVersion

Sat Jan 18, 2020 8:26 pm

NAME Step-SemanticVersion



SYNOPSIS

Increments a Semantic Version number.





SYNTAX

Step-SemanticVersion [-InputObject] <Object> [[-Type] <String>] [[-Label] <String>] [<CommonParameters>]





DESCRIPTION

The Step-SemanticVersion function increments the elements of a Semantic Version number in a way that is

compliant with the Semantic Version 2.0 specification.



- Incrementing the Major number will reset the Minor number and the Patch number to 0. A pre-release version

will be incremented to the normal version number.

- Incrementing the Minor number will reset the Patch number to 0. A pre-release version will be incremented to

the normal version number.

- Incrementing the Patch number does not change any other parts of the version number. A pre-release version

will be incremented to the normal version number.

- Incrementing the PreRelease number does not change any other parts of the version number.

- Incrementing the Build number does not change any other parts of the version number.





PARAMETERS

-InputObject <Object>

The Semantic Version number to be incremented.

$er = Write-Error @erHash 2>&1



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue)

Accept wildcard characters? false



-Type <String>

The desired increment type.

Valid values are Build, PreRelease, PrePatch, PreMinor, PreMajor, Patch, Minor, or Major.

The default value is PreRelease.



Required? false

Position? 2

Default value PreRelease

Accept pipeline input? false

Accept wildcard characters? false



-Label <String>

The metadata label to use with an incrament type of Build, PreRelease, PreMajor, PreMinor, or PrePatch.

If specified, the value replaces the existing label. If not specified, the existing label will be incremented.

This parameter is ignored for an increment type of Major, Minor, or Patch.



Required? false

Position? 3

Default value

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

PoshSemanticVersion





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>'1.1.1' | Step-SemanticVersion



Major : 1

Minor : 1

Patch : 2

PreRelease : 0

Build :



This command takes a semantic version string from the pipeline and increments the pre-release version. Because

the element to increment was not specified, the default value of 'PreRelease was used'.









-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Step-SemanticVersion -Version 1.1.1 -Level Minor



Major : 1

Minor : 2

Patch : 0

PreRelease :

Build :



This command converts the string '1.1.1' to the semantic version object equivalent of '1.2.0'.









-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Step-SemanticVersion -v 1.1.1 -i patch



Major : 1

Minor : 1

Patch : 2

PreRelease :

Build :



This command converts the string '1.1.1' to the semantic version object equivalent of '1.1.2'. This example

shows the use of the parameter aliases "v" and "i" for Version and Level (increment), respectively.









-------------------------- EXAMPLE 4 --------------------------



PS C:\\>Step-SemanticVersion 1.1.1 Major



Major : 2

Minor : 0

Patch : 0

PreRelease :

Build :



This command converts the string '1.1.1' to the semantic version object equivalent of '2.0.0'. This example

shows the use of positional parameters.











RELATED LINKS