Browse Source

Rework version number to include short commit hash

tags/v0.1
Starbeamrainbowlabs 3 years ago
parent
commit
73b2efa75f

+ 7
- 2
SpritePacker/Program.cs View File

@@ -15,13 +15,19 @@ namespace SpritePacker

class Program
{
public static string Version = Utilities.GetEmbeddedResourceContent("SpritePacker.Version.txt").Trim();

private static ProgramMode programMode = ProgramMode.Normal;
private static string helpTextFilename = "SpritePacker.Resources.HelpText.txt";
private static string versionTextFilename = "SpritePacker.Resources.VersionText.txt";
private static string commitHashFilename = "SpritePacker.latest-commit-hash.txt";
private static List<string> values = new List<string>();

public static void Main(string[] args)
{
string commitHash = Utilities.GetEmbeddedResourceContent(commitHashFilename).Trim();
Version += "-" + commitHash.Substring(commitHash.Length - 7);

for(int i = 0; i < args.Length; i++)
{
switch(args[i])
@@ -47,9 +53,8 @@ namespace SpritePacker
case ProgramMode.DisplayVersionText:
string textFileName = programMode == ProgramMode.DisplayHelpText ? helpTextFilename : versionTextFilename;
string helpText = Utilities.GetEmbeddedResourceContent(textFileName);
string commitHash = Utilities.GetEmbeddedResourceContent("SpritePacker.latest-commit-hash.txt").Trim();
Dictionary<string, string> templateValues = new Dictionary<string, string>() {
{ "version", Utilities.GetProgramVersion().ToString() },
{ "version", Version },
{ "build-date", Utilities.GetProgramBuildDate().ToString("dd/MM/yyyy h:mmtt") },
{ "commit-hash", commitHash.Substring(commitHash.Length - 7) },
{ "commit-url", string.Format("https://git.starbeamrainbowlabs.com/sbrl/SpritePacker/commit/{0}", commitHash) }

+ 1
- 1
SpritePacker/Resources/HelpText.txt View File

@@ -1,4 +1,4 @@
SpritePacker v{version}, by Starbeamrainbowlabs
SpritePacker {version}, by Starbeamrainbowlabs
Built at {build-date} from git commit {commit-hash}

Usage:

+ 1
- 2
SpritePacker/Resources/VersionText.txt View File

@@ -1,5 +1,4 @@
SpritePacker v{version}, by Starbeamrainbowlabs
SpritePacker {version}, by Starbeamrainbowlabs

Built at {build-date}
Built from git commit hash {commit-hash}
Commit url: {commit-url}

+ 1
- 0
SpritePacker/SpritePacker.csproj View File

@@ -48,6 +48,7 @@
<EmbeddedResource Include="latest-commit-hash.txt" />
<EmbeddedResource Include="Resources\VersionText.txt" />
<EmbeddedResource Include="Resources\HelpText.txt" />
<EmbeddedResource Include="Version.txt" />
</ItemGroup>
<ItemGroup>
<Folder Include="Resources\" />

+ 1
- 0
SpritePacker/Version.txt View File

@@ -0,0 +1 @@
v0.1

Loading…
Cancel
Save