Skip to content

Commit

Permalink
update release version info
Browse files Browse the repository at this point in the history
  • Loading branch information
Scighost committed May 30, 2023
1 parent 6a64f2f commit 9112d1e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
41 changes: 34 additions & 7 deletions Starward.Core/Metadata/VersionRelease.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Starward.Core.Metadata;

public class ReleaseVersion
public class ReleaseVersion : IJsonOnDeserialized
{

public string Version { get; set; }
Expand Down Expand Up @@ -35,13 +35,44 @@ public class ReleaseVersion
public string PortableHash { get; set; }


public string SeparatePrefix { get; set; }


public List<ReleaseFile> SeparateFiles { get; set; }


[JsonIgnore]
public string ReleasePage => $"https://github.com/Scighost/Starward/releases/tag/{Version}";


public void OnDeserialized()
{
if (SeparateFiles is not null)
{
string prefix;
if (string.IsNullOrWhiteSpace(SeparatePrefix))
{
#if DEBUG || DEV
prefix = $"https://starward.scighost.com/release/separate_files/dev/";
#else
prefix = $"https://starward.scighost.com/release/separate_files/";
#endif
}
else
{
prefix = SeparatePrefix;
}
foreach (var file in SeparateFiles)
{
if (string.IsNullOrWhiteSpace(file.Url))
{
file.Url = Path.Combine(prefix, file.Hash);
}
}

}
}

}


Expand All @@ -57,11 +88,7 @@ public class ReleaseFile

public string Hash { get; set; }

[JsonIgnore]
#if DEBUG || DEV
public string Url => $"https://starward.scighost.com/release/separate_files/dev/{Hash}";
#else
public string Url => $"https://starward.scighost.com/release/separate_files/{Hash}";
#endif

public string Url { get; set; }

}
2 changes: 2 additions & 0 deletions metadata.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,12 @@ $release = @{
Portable = "https://starward.scighost.com/release/package/$portableName"
PortableSize = (Get-Item $portableFile).Length
PortableHash = (Get-FileHash $portableFile).Hash
SeparatePrefix = "https://starward.scighost.com/release/separate_files/"
};

if ($Dev) {
$release.Portable = "https://starward.scighost.com/release/package/dev/$portableName";
$release.SeparatePrefix = "https://starward.scighost.com/release/separate_files/dev/";
}

Out-File -Path "$metadata/version_preview_$Architecture.json" -InputObject (ConvertTo-Json $release);
Expand Down

0 comments on commit 9112d1e

Please sign in to comment.