mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-03-06 14:41:08 +00:00
Compare commits
5 Commits
Canary-1.3
...
Canary-1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b761a2c86d | ||
|
|
693837dca7 | ||
|
|
70abff072b | ||
|
|
1e861b99a9 | ||
|
|
13e404bde0 |
24
.github/workflows/canary.yml
vendored
24
.github/workflows/canary.yml
vendored
@@ -34,19 +34,6 @@ jobs:
|
||||
echo "build_version=${{ env.RYUJINX_BASE_VERSION }}.${{ github.run_number }}" >> $GITHUB_OUTPUT
|
||||
echo "prev_build_version=${{ env.RYUJINX_BASE_VERSION }}.$((${{ github.run_number }} - 1))" >> $GITHUB_OUTPUT
|
||||
shell: bash
|
||||
|
||||
- name: Install GitLabCli
|
||||
run: |
|
||||
mkdir -p $HOME/.bin
|
||||
gh release download -R GreemDev/GLI -O gli -p 'GitLabCli-linux_x64'
|
||||
chmod +x gli
|
||||
mv gli $HOME/.bin/
|
||||
echo "$HOME/.bin" >> $GITHUB_PATH
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create GitLab tag
|
||||
run: gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/ryujinx --command=CreateTag "Canary-${{ steps.version_info.outputs.build_version }}|master"
|
||||
|
||||
- name: Create release
|
||||
uses: ncipollo/release-action@v1
|
||||
@@ -312,6 +299,9 @@ jobs:
|
||||
- macos_release
|
||||
- release
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
|
||||
- name: Get version info
|
||||
id: version_info
|
||||
run: |
|
||||
@@ -330,10 +320,14 @@ jobs:
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Create tag
|
||||
run: |
|
||||
gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/ryujinx --command=CreateTag "Canary-${{ steps.version_info.outputs.build_version }}|${{ steps.version_info.outputs.git_short_hash }}"
|
||||
|
||||
- name: Create release
|
||||
run: |
|
||||
gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/canary --command=CreateReleaseFromGenericPackageFiles "Ryubing-Canary|${{ steps.version_info.outputs.build_version }}|main|Canary ${{ steps.version_info.outputs.build_version }}|**[Full Changelog](https://git.ryujinx.app/ryubing/ryujinx/-/compare/Canary-${{ steps.version_info.outputs.prev_build_version }}...Canary-${{ steps.version_info.outputs.build_version }})**"
|
||||
gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/canary --command=CreateReleaseFromGenericPackageFiles "Ryubing-Canary|${{ steps.version_info.outputs.build_version }}|main|Canary ${{ steps.version_info.outputs.build_version }}|**Full Changelog:** [`${{ steps.version_info.outputs.prev_build_version }}...${{ steps.version_info.outputs.build_version }}`](https://git.ryujinx.app/ryubing/ryujinx/-/compare/Canary-${{ steps.version_info.outputs.prev_build_version }}...Canary-${{ steps.version_info.outputs.build_version }})"
|
||||
|
||||
- name: Send notification webhook
|
||||
run: |
|
||||
gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/canary --command=SendUpdateMessage "${{ steps.version_info.outputs.build_version }}|FF4500|${{ secrets.CANARY_DISCORD_WEBHOOK }}|https://avatars.githubusercontent.com/u/192939710?s=200&v=4"
|
||||
gli --access-token=${{ secrets.GITLAB_TOKEN }} --project=ryubing/canary --command=SendUpdateMessage "${{ steps.version_info.outputs.build_version }}|FF4500|${{ secrets.CANARY_DISCORD_WEBHOOK }}|https://avatars.githubusercontent.com/u/192939710?s=200&v=4|false"
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<PackageVersion Include="Ryujinx.Audio.OpenAL.Dependencies" Version="1.21.0.1" />
|
||||
<PackageVersion Include="Ryujinx.Graphics.Nvdec.Dependencies.AllArch" Version="6.1.2-build3" />
|
||||
<PackageVersion Include="Ryujinx.Graphics.Vulkan.Dependencies.MoltenVK" Version="1.2.0" />
|
||||
<PackageVersion Include="Ryujinx.LibHac" Version="0.20.0-alpha.107" />
|
||||
<PackageVersion Include="Ryujinx.LibHac" Version="0.20.0-alpha.110" />
|
||||
<PackageVersion Include="Ryujinx.SDL2-CS" Version="2.30.0-build32" />
|
||||
<PackageVersion Include="Gommon" Version="2.7.1.1" />
|
||||
<PackageVersion Include="securifybv.ShellLink" Version="0.1.0" />
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Common.Models.GitLab
|
||||
{
|
||||
public class GitLabReleaseAssetJsonResponse
|
||||
{
|
||||
[JsonPropertyName("links")]
|
||||
public GitLabReleaseAssetLinkJsonResponse[] Links { get; set; }
|
||||
|
||||
public class GitLabReleaseAssetLinkJsonResponse
|
||||
{
|
||||
[JsonPropertyName("id")]
|
||||
public long Id { get; set; }
|
||||
[JsonPropertyName("name")]
|
||||
public string AssetName { get; set; }
|
||||
[JsonPropertyName("url")]
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Ryujinx.Ava.Common.Models.GitLab
|
||||
{
|
||||
public class GitLabReleasesJsonResponse
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonPropertyName("tag_name")]
|
||||
public string TagName { get; set; }
|
||||
|
||||
[JsonPropertyName("assets")]
|
||||
public GitLabReleaseAssetJsonResponse Assets { get; set; }
|
||||
}
|
||||
|
||||
[JsonSerializable(typeof(GitLabReleasesJsonResponse), GenerationMode = JsonSourceGenerationMode.Metadata)]
|
||||
public partial class GitLabReleasesJsonSerializerContext : JsonSerializerContext;
|
||||
}
|
||||
@@ -1,15 +1,13 @@
|
||||
using Gommon;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Common.Models.GitLab;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Common;
|
||||
using Ryujinx.Common.Helper;
|
||||
using Ryujinx.Common.Logging;
|
||||
using Ryujinx.Common.Utilities;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Json;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@@ -17,7 +15,31 @@ namespace Ryujinx.Ava.Systems
|
||||
{
|
||||
internal static partial class Updater
|
||||
{
|
||||
private static GitLabReleaseChannels.ChannelType _currentGitLabReleaseChannel;
|
||||
private static string CreateUpdateQueryUrl()
|
||||
{
|
||||
#pragma warning disable CS8524
|
||||
var os = RunningPlatform.CurrentOS switch
|
||||
#pragma warning restore CS8524
|
||||
{
|
||||
OperatingSystemType.MacOS => "mac",
|
||||
OperatingSystemType.Linux => "linux",
|
||||
OperatingSystemType.Windows => "win"
|
||||
};
|
||||
|
||||
var arch = RunningPlatform.Architecture switch
|
||||
{
|
||||
Architecture.Arm64 => "arm",
|
||||
Architecture.X64 => "amd64",
|
||||
_ => null
|
||||
};
|
||||
|
||||
if (arch is null)
|
||||
return null;
|
||||
|
||||
var rc = ReleaseInformation.IsCanaryBuild ? "canary" : "stable";
|
||||
|
||||
return $"https://update.ryujinx.app/latest/query?os={os}&arch={arch}&rc={rc}";
|
||||
}
|
||||
|
||||
private static async Task<Optional<(Version Current, Version Incoming)>> CheckGitLabVersionAsync(bool showVersionUpToDate = false)
|
||||
{
|
||||
@@ -35,38 +57,42 @@ namespace Ryujinx.Ava.Systems
|
||||
return default;
|
||||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, "Checking for updates from https://git.ryujinx.app.");
|
||||
if (CreateUpdateQueryUrl() is not {} updateUrl)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, "Could not determine URL for updates.");
|
||||
|
||||
_running = false;
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, $"Checking for updates from {updateUrl}.");
|
||||
|
||||
// Get latest version number from GitLab API
|
||||
using HttpClient jsonClient = ConstructHttpClient();
|
||||
|
||||
// GitLab instance is located in Ukraine. Connection times will vary across the world.
|
||||
jsonClient.Timeout = TimeSpan.FromSeconds(10);
|
||||
jsonClient.Timeout = TimeSpan.FromSeconds(10);
|
||||
|
||||
if (_currentGitLabReleaseChannel == null)
|
||||
try
|
||||
{
|
||||
GitLabReleaseChannels releaseChannels = await GitLabReleaseChannels.GetAsync(jsonClient);
|
||||
UpdaterResponse response =
|
||||
await jsonClient.GetFromJsonAsync(updateUrl, UpdaterResponseJsonContext.Default.UpdaterResponse);
|
||||
|
||||
_currentGitLabReleaseChannel = ReleaseInformation.IsCanaryBuild
|
||||
? releaseChannels.Canary
|
||||
: releaseChannels.Stable;
|
||||
_buildVer = response.Tag;
|
||||
_buildUrl = response.DownloadUrl;
|
||||
_changelogUrlFormat = response.ReleaseUrlFormat;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error?.Print(LogClass.Application, $"An error occurred when parsing JSON response from API ({e.GetType().AsFullNamePrettyString()}): {e.Message}");
|
||||
|
||||
Logger.Info?.Print(LogClass.Application, $"Loaded GitLab release channel for '{(ReleaseInformation.IsCanaryBuild ? "canary" : "stable")}'");
|
||||
|
||||
_changelogUrlFormat = _currentGitLabReleaseChannel.UrlFormat;
|
||||
_running = false;
|
||||
return default;
|
||||
}
|
||||
|
||||
string fetchedJson = await jsonClient.GetStringAsync(_currentGitLabReleaseChannel.GetLatestReleaseApiUrl());
|
||||
GitLabReleasesJsonResponse fetched = JsonHelper.Deserialize(fetchedJson, _glSerializerContext.GitLabReleasesJsonResponse);
|
||||
|
||||
_buildVer = fetched.TagName;
|
||||
_buildUrl = fetched.Assets.Links
|
||||
.FirstOrDefault(link =>
|
||||
link.AssetName.StartsWith("ryujinx") && link.AssetName.EndsWith(_platformExt)
|
||||
)?.Url;
|
||||
|
||||
// If build URL not found, assume no new update is available.
|
||||
if (_buildUrl is null)
|
||||
if (_buildUrl is null or "")
|
||||
{
|
||||
if (showVersionUpToDate)
|
||||
{
|
||||
@@ -104,35 +130,17 @@ namespace Ryujinx.Ava.Systems
|
||||
|
||||
return (currentVersion, newVersion);
|
||||
}
|
||||
|
||||
[JsonSerializable(typeof(UpdaterResponse))]
|
||||
partial class UpdaterResponseJsonContext : JsonSerializerContext;
|
||||
|
||||
[JsonSerializable(typeof(GitLabReleaseChannels))]
|
||||
partial class GitLabReleaseChannelPairContext : JsonSerializerContext;
|
||||
|
||||
public class GitLabReleaseChannels
|
||||
public class UpdaterResponse
|
||||
{
|
||||
public static async Task<GitLabReleaseChannels> GetAsync(HttpClient httpClient)
|
||||
=> await httpClient.GetFromJsonAsync(
|
||||
"https://git.ryujinx.app/ryubing/ryujinx/-/snippets/1/raw/main/meta.json",
|
||||
GitLabReleaseChannelPairContext.Default.GitLabReleaseChannels);
|
||||
[JsonPropertyName("tag")] public string Tag { get; set; }
|
||||
[JsonPropertyName("download_url")] public string DownloadUrl { get; set; }
|
||||
[JsonPropertyName("web_url")] public string ReleaseUrl { get; set; }
|
||||
|
||||
[JsonPropertyName("stable")] public ChannelType Stable { get; set; }
|
||||
[JsonPropertyName("canary")] public ChannelType Canary { get; set; }
|
||||
|
||||
public class ChannelType
|
||||
{
|
||||
[JsonPropertyName("id")] public long Id { get; set; }
|
||||
|
||||
[JsonPropertyName("group")] public string Group { get; set; }
|
||||
|
||||
[JsonPropertyName("project")] public string Project { get; set; }
|
||||
|
||||
public string UrlFormat => $"https://git.ryujinx.app/{ToString()}/-/releases/{{0}}";
|
||||
|
||||
public override string ToString() => $"{Group}/{Project}";
|
||||
|
||||
public string GetLatestReleaseApiUrl() =>
|
||||
$"https://git.ryujinx.app/api/v4/projects/{Id}/releases/permalink/latest";
|
||||
}
|
||||
[JsonIgnore] public string ReleaseUrlFormat => ReleaseUrl.Replace(Tag, "{0}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,6 @@ using ICSharpCode.SharpZipLib.Tar;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using Ryujinx.Ava.Common.Locale;
|
||||
using Ryujinx.Ava.Common.Models.Github;
|
||||
using Ryujinx.Ava.Common.Models.GitLab;
|
||||
using Ryujinx.Ava.UI.Helpers;
|
||||
using Ryujinx.Ava.Utilities;
|
||||
using Ryujinx.Common;
|
||||
@@ -33,19 +32,14 @@ namespace Ryujinx.Ava.Systems
|
||||
internal static partial class Updater
|
||||
{
|
||||
private static readonly GithubReleasesJsonSerializerContext _ghSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
private static readonly GitLabReleasesJsonSerializerContext _glSerializerContext = new(JsonHelper.GetDefaultSerializerOptions());
|
||||
|
||||
|
||||
private static readonly string _platformExt = BuildPlatformExtension();
|
||||
private static readonly string _homeDir = AppDomain.CurrentDomain.BaseDirectory;
|
||||
private static readonly string _updateDir = Path.Combine(Path.GetTempPath(), "Ryujinx", "update");
|
||||
private static readonly string _updatePublishDir = Path.Combine(_updateDir, "publish");
|
||||
private const int ConnectionCount = 4;
|
||||
|
||||
private static string _buildVer;
|
||||
|
||||
|
||||
private static readonly string _platformExt = BuildPlatformExtension();
|
||||
|
||||
private static string _buildUrl;
|
||||
private static long _buildSize;
|
||||
private static bool _updateSuccessful;
|
||||
@@ -168,7 +162,7 @@ namespace Ryujinx.Ava.Systems
|
||||
HttpClient result = new();
|
||||
|
||||
// Required by GitHub to interact with APIs.
|
||||
result.DefaultRequestHeaders.Add("User-Agent", "Ryujinx-Updater/1.0.0");
|
||||
result.DefaultRequestHeaders.Add("User-Agent", $"Ryujinx-Updater/{ReleaseInformation.Version}");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user