blob: 0acbf023b0022d0bb865b2cbf17780250ec5cc38 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
$sha = (git rev-parse --short=7 HEAD)
if ($env:GITHUB_REPOSITORY) {
$ref = "$env:GITHUB_REPOSITORY/$(git symbolic-ref --short HEAD)"
} else {
$remoteUrl = (git remote get-url origin)
# handle github urls only, can't predict other origins behavior
if ($remoteUrl -match '(?:github\.com[:/])([^/:]+/[^/]+?)(?:\.git)?$') {
$ref = "$($matches[1])/$(git symbolic-ref --short HEAD)"
}else{
# fallback to just symbolic ref in case remote isnt what we expect
$ref = "UNKNOWN/$(git symbolic-ref --short HEAD)"
}
}
$build = 560 # Note: Build/network has to stay static for now, as without it builds wont be able to play together. We can change it later when we have a better versioning scheme in place.
$suffix = ""
# TODO Re-enable
# If we are running in GitHub Actions, use the run number as the build number
# if ($env:GITHUB_RUN_NUMBER) {
# $build = $env:GITHUB_RUN_NUMBER
# }
# If we have uncommitted changes, add a suffix to the version string
if (git status --porcelain) {
$suffix = "-dev"
}
@"
#pragma once
#define VER_PRODUCTBUILD $build
#define VER_PRODUCTVERSION_STR_W L"$sha$suffix"
#define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W
#define VER_BRANCHVERSION_STR_W L"$ref"
#define VER_NETWORK VER_PRODUCTBUILD
"@ | Set-Content "Common/BuildVer.h"
|