diff --git a/mc-manager/BUILD.py b/mc-manager/BUILD.py index 5b0c0d2..088e0b8 100644 --- a/mc-manager/BUILD.py +++ b/mc-manager/BUILD.py @@ -1,6 +1,6 @@ #!/usr/bin/python3 -import os +import os, datetime RIDS = [ "linux-x64", @@ -11,11 +11,26 @@ RIDS = [ "win-arm64" ] +def get_timestamp(): + # Yep. We're emulating a bug where our autogenerated timestamps do not have leading zeros + # even though it would be semantically correct to prepend them. + # This has been a bug since the software was created and now we need to keep it, + # lest we break any end user's automatic updating script. + now = datetime.datetime.now(datetime.timezone.utc) + + year = now.strftime("%Y") + month_day = int(now.strftime("%m%d")) + hour_min = int(now.strftime("%H%M")) + + return f"{year}.{month_day}.{hour_min}" + +CURRENT_TIMESTAMP = get_timestamp() + for rid in RIDS: target_os, arch = rid.split("-") print(f"=> BUILDING: {rid}") - ret = os.system(rf"dotnet publish --sc true --os {target_os} --arch {arch} -o ./pub/{rid}") + ret = os.system(rf"dotnet publish --sc true --os {target_os} --arch {arch} -p:Version={CURRENT_TIMESTAMP} -o ./pub/{rid}") if ret != 0: raise OSError("Build error") diff --git a/mc-manager/mc-manager.csproj b/mc-manager/mc-manager.csproj index 06adf4b..0a58984 100644 --- a/mc-manager/mc-manager.csproj +++ b/mc-manager/mc-manager.csproj @@ -7,7 +7,7 @@ enable enable - $([System.DateTime]::UtcNow.ToString("yyyy.MMdd.HHmm")) + $([System.DateTime]::UtcNow.ToString("yyyy.MMdd.HHmm"))