fix #1 - make build script timestamps hard coded and make versioning use the Version tag
i thought this would be difficult and require XML parsing. i guess i was right when i said "command line arguments"
This commit is contained in:
+17
-2
@@ -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")
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
|
||||
<AssemblyVersion>$([System.DateTime]::UtcNow.ToString("yyyy.MMdd.HHmm"))</AssemblyVersion>
|
||||
<Version Condition="'$(Version)' == ''">$([System.DateTime]::UtcNow.ToString("yyyy.MMdd.HHmm"))</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user