Enhance list-latest-tag.ps1

This commit is contained in:
Markus Fleschutz 2021-04-28 13:07:20 +02:00
parent 478d62aa89
commit 2345cc14c8

View File

@ -1,4 +1,4 @@
<#
<#
.SYNTAX list-latest-tag.ps1 [<repo-dir>]
.DESCRIPTION lists the latest tag on the current branch in a Git repository
.LINK https://github.com/fleschutz/PowerShell
@ -17,10 +17,11 @@ try {
$Null = (git --version)
if ($lastExitCode -ne "0") { throw "Can't execute 'git' - make sure Git is installed and available" }
& git fetch --all --recurse-submodules --jobs=4
& git fetch
if ($lastExitCode -ne "0") { throw "'git fetch' failed" }
& git describe --tags --abbrev=0
$Tag = (git describe --tags --abbrev=0)
"🔖$Tag"
exit 0
} catch {
write-error "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"