mirror of https://github.com/pulumi/pulumi.git
19 lines
545 B
PowerShell
19 lines
545 B
PowerShell
Set-StrictMode -Version 2.0
|
|
$ErrorActionPreference="Stop"
|
|
|
|
git update-index -q --refresh
|
|
git diff-files --quiet | Out-Null
|
|
|
|
$dirtyTag=""
|
|
if ($LASTEXITCODE -ne 0) {
|
|
$dirtyTag = "-dirty"
|
|
}
|
|
|
|
try {
|
|
git describe --tags --exact-match 2>$null
|
|
# If we get here the above did not throw, so we can use the exact tag
|
|
Write-Host "$(git describe --tags --exact-match)$dirtyTag"
|
|
} catch {
|
|
# Otherwise, append the timestamp of the commit and the hash
|
|
Write-Host "$(git describe --tags --abbrev=0)-$(git show -s --format='%ct-g%h')$dirtyTag"
|
|
} |