2024-11-22 20:38:58 +00:00
|
|
|
using System;
|
2022-03-04 17:03:16 +00:00
|
|
|
using System.Reflection;
|
2022-01-24 17:49:14 +00:00
|
|
|
|
|
|
|
namespace Ryujinx.Common
|
2022-01-22 16:56:09 +00:00
|
|
|
{
|
|
|
|
// DO NOT EDIT, filled by CI
|
2023-01-07 08:06:13 +00:00
|
|
|
public static class ReleaseInformation
|
2022-01-22 16:56:09 +00:00
|
|
|
{
|
2024-11-06 22:48:20 +00:00
|
|
|
private const string CanaryChannel = "canary";
|
|
|
|
private const string ReleaseChannel = "release";
|
2022-03-04 17:03:16 +00:00
|
|
|
|
2024-01-29 18:58:18 +00:00
|
|
|
private const string BuildVersion = "%%RYUJINX_BUILD_VERSION%%";
|
2024-10-13 02:44:13 +00:00
|
|
|
public const string BuildGitHash = "%%RYUJINX_BUILD_GIT_HASH%%";
|
2024-01-29 18:58:18 +00:00
|
|
|
private const string ReleaseChannelName = "%%RYUJINX_TARGET_RELEASE_CHANNEL_NAME%%";
|
|
|
|
private const string ConfigFileName = "%%RYUJINX_CONFIG_FILE_NAME%%";
|
|
|
|
|
2023-06-28 16:41:38 +00:00
|
|
|
public const string ReleaseChannelOwner = "%%RYUJINX_TARGET_RELEASE_CHANNEL_OWNER%%";
|
2024-11-11 05:32:37 +00:00
|
|
|
public const string ReleaseChannelSourceRepo = "%%RYUJINX_TARGET_RELEASE_CHANNEL_SOURCE_REPO%%";
|
2023-06-28 16:41:38 +00:00
|
|
|
public const string ReleaseChannelRepo = "%%RYUJINX_TARGET_RELEASE_CHANNEL_REPO%%";
|
2022-01-22 16:56:09 +00:00
|
|
|
|
2024-01-29 18:58:18 +00:00
|
|
|
public static string ConfigName => !ConfigFileName.StartsWith("%%") ? ConfigFileName : "Config.json";
|
2023-06-28 16:41:38 +00:00
|
|
|
|
2024-01-29 18:58:18 +00:00
|
|
|
public static bool IsValid =>
|
|
|
|
!BuildGitHash.StartsWith("%%") &&
|
|
|
|
!ReleaseChannelName.StartsWith("%%") &&
|
|
|
|
!ReleaseChannelOwner.StartsWith("%%") &&
|
2024-11-11 05:32:37 +00:00
|
|
|
!ReleaseChannelSourceRepo.StartsWith("%%") &&
|
2024-01-29 18:58:18 +00:00
|
|
|
!ReleaseChannelRepo.StartsWith("%%") &&
|
|
|
|
!ConfigFileName.StartsWith("%%");
|
2022-03-04 17:03:16 +00:00
|
|
|
|
2024-11-07 01:46:20 +00:00
|
|
|
public static bool IsCanaryBuild => IsValid && ReleaseChannelName.Equals(CanaryChannel);
|
2024-11-06 22:48:20 +00:00
|
|
|
|
2024-11-07 01:46:20 +00:00
|
|
|
public static bool IsReleaseBuild => IsValid && ReleaseChannelName.Equals(ReleaseChannel);
|
2022-03-04 17:03:16 +00:00
|
|
|
|
2024-01-29 18:58:18 +00:00
|
|
|
public static string Version => IsValid ? BuildVersion : Assembly.GetEntryAssembly()!.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;
|
2024-11-22 20:38:58 +00:00
|
|
|
|
|
|
|
public static string GetChangelogUrl(Version currentVersion, Version newVersion) =>
|
|
|
|
IsCanaryBuild
|
|
|
|
? $"https://github.com/{ReleaseChannelOwner}/{ReleaseChannelSourceRepo}/compare/Canary-{currentVersion}...Canary-{newVersion}"
|
|
|
|
: $"https://github.com/{ReleaseChannelOwner}/{ReleaseChannelSourceRepo}/releases/tag/{newVersion}";
|
|
|
|
|
|
|
|
public static string GetChangelogForVersion(Version version) =>
|
|
|
|
$"https://github.com/{ReleaseChannelOwner}/{ReleaseChannelRepo}/releases/tag/{version}";
|
2022-01-22 16:56:09 +00:00
|
|
|
}
|
2023-06-28 16:41:38 +00:00
|
|
|
}
|