Skip to content

Instantly share code, notes, and snippets.

@Agazoth
Last active September 12, 2018 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Agazoth/c4021672eec42af83080b0f4163c8963 to your computer and use it in GitHub Desktop.
Save Agazoth/c4021672eec42af83080b0f4163c8963 to your computer and use it in GitHub Desktop.
properties {
# This needs to be updated to fit your build
$psd1 = $ModuleRootFolder\MyModule.psd1
}
Task IncrementVersion {
$CurrentVersion = Test-ModuleManifest $Script:psd1 | Select-Object -ExpandProperty Version
$Build = $ModuleManifestVersion.Build
$Minor = $ModuleManifestVersion.Minor
$Major = $ModuleManifestVersion.Major
if ($IncrementMajorVersion){$Major++;$Minor=0;$Build=-1}
elseif ($IncrementMinorVersion){$Minor++;$Build=-1}
$Build++
$NewVersion = [System.Version]$("{0}.{1}.{2}" -f $Major,$Minor,$Build)
Update-ModuleManifest -Path $psd1 -ModuleVersion $NewVersion
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment