aboutsummaryrefslogtreecommitdiff
path: root/Minecraft.Client/prebuild.ps1
diff options
context:
space:
mode:
authorLoki Rautio <lokirautio@gmail.com>2026-03-09 03:25:05 -0500
committerLoki Rautio <lokirautio@gmail.com>2026-03-09 03:25:05 -0500
commit0c4f4599045edad935403e4d79d28f6b9aa95833 (patch)
tree638ff44db51c8e27826e56bacb5af764f98ef2d0 /Minecraft.Client/prebuild.ps1
parent7a4f57e3e692c621c20e58bc658d321842872de5 (diff)
Always show version overlay, add more info
Diffstat (limited to 'Minecraft.Client/prebuild.ps1')
-rw-r--r--Minecraft.Client/prebuild.ps118
1 files changed, 16 insertions, 2 deletions
diff --git a/Minecraft.Client/prebuild.ps1 b/Minecraft.Client/prebuild.ps1
index fa2c487c..0acbf023 100644
--- a/Minecraft.Client/prebuild.ps1
+++ b/Minecraft.Client/prebuild.ps1
@@ -1,5 +1,18 @@
$sha = (git rev-parse --short=7 HEAD)
-$ref = (git symbolic-ref --short 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 = ""
@@ -18,7 +31,8 @@ if (git status --porcelain) {
#pragma once
#define VER_PRODUCTBUILD $build
-#define VER_PRODUCTVERSION_STR_W L"$sha$suffix ($ref)"
+#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"