From f261ea3b88099341f24e1ad7d258cf0ccef64e21 Mon Sep 17 00:00:00 2001 From: Li Date: Sun, 8 May 2022 12:30:40 +1200 Subject: [PATCH] Update made automatically due to pressing build --- HorseIsleServer/LibHISP/Server/ServerVersion.cs | 4 ++-- HorseIsleServer/build.py | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/HorseIsleServer/LibHISP/Server/ServerVersion.cs b/HorseIsleServer/LibHISP/Server/ServerVersion.cs index 98173e7..26f66cb 100644 --- a/HorseIsleServer/LibHISP/Server/ServerVersion.cs +++ b/HorseIsleServer/LibHISP/Server/ServerVersion.cs @@ -46,7 +46,7 @@ namespace HISP.Server } public static string GetVersionString() { - return Resources.GitTag.Replace("\r", "").Replace("\n", "").ToString().Trim() + "."+ GetCommitHashVersion(); + return Resources.GitTag.Replace("\r", "").Replace("\n", "").ToString().Trim(); } public static string GetBranch() { @@ -72,7 +72,7 @@ namespace HISP.Server } public static string GetBuildString() { - return PRODUCT + " " + GetVersionString() + " " + GetBranch() + " (" + GetArchitecture() + "; " + GetPlatform() + "); Built @ " + GetBuildDate() + " " + GetBuildTime(); + return PRODUCT + " " + GetVersionString() + " " + GetBranch() + "@" + GetCommitHash(4) + " (" + GetArchitecture() + "; " + GetPlatform() + "); Built @ " + GetBuildDate() + " " + GetBuildTime(); } } } diff --git a/HorseIsleServer/build.py b/HorseIsleServer/build.py index 2cc8abc..2c3c496 100644 --- a/HorseIsleServer/build.py +++ b/HorseIsleServer/build.py @@ -1,7 +1,7 @@ -#!/bin/python3 +#!/usr/bin/python3 import os import subprocess -import date +import time import datetime import struct import binascii @@ -23,8 +23,12 @@ commit_tag = "v0.0.0" commit_branch = "master" try: + subprocess.run(['git', 'add', '-A'], stdout=subprocess.PIPE) + subprocess.run(['git', 'commit', '-m', 'Update made automatically due to pressing build'], stdout=subprocess.PIPE) commit_hash = subprocess.run(['git', 'rev-parse', '--verify', 'HEAD'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8") commit_tag = subprocess.run(['git', 'describe', '--abbrev=0', '--tags'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8") + commits_since_tag = subprocess.run(['git rev-list', commit_tag+'..HEAD', '--count'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8") + commit_tag = + "." + commits_since_tag commit_branch = subprocess.run(['git', 'branch', '--show-current'], stdout=subprocess.PIPE).stdout.replace(b"\r", b"").replace(b"\n", b"").decode("UTF-8") except FileNotFoundError: print("Git not installed")