pulumi/scripts/get-version.ps1
Matt Ellis 608af9349d Publish SDK per build
After the move to stop including packages in the SDK, we no longer
published an SDK per build. This corrects this. Since the only things
in the SDK today are the language plugins and the CLI itself, we can
publish an SDK per build from pulumi/pulumi.

This change re-uses the existing infrastructure we have in
pulumi/sdk.

Fixes #1076
2018-04-12 10:11:56 -07:00

21 lines
558 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 >$null 2>$null
# If we get here the above did not throw, so we can use the exact tag
Write-Output "$(git describe --tags --exact-match)$dirtyTag"
} catch {
# Otherwise, append the timestamp of the commit and the hash
Write-Output "$(git describe --tags --abbrev=0)-$(git show -s --format='%ct-g%h')$dirtyTag"
}