mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 11:42:22 +08:00
WPF: Switch to Clowd.Squirrel
This commit is contained in:
parent
9d99da71c0
commit
f130af64b6
11
RELEASING.md → .github/RELEASING.md
vendored
11
RELEASING.md → .github/RELEASING.md
vendored
|
@ -1,10 +1,10 @@
|
||||||
# 新版本发布流程备忘
|
# 新版本发布流程备忘
|
||||||
|
|
||||||
- 在 `dev-1.3` 分支完成修改的功能,实际运行测试一遍
|
- 在 `dev` 分支完成修改的功能,实际运行测试一遍
|
||||||
- 在 GitHub 创建 Release 并发布
|
- 在 GitHub 创建 Release 并发布
|
||||||
- GitHub Actions 会自动补充 Assets
|
- GitHub Actions 会自动补充 Assets
|
||||||
- 从 Artifacts 里下载 `WPF-NupkgReleases`
|
- 从 Artifacts 里下载 `WPF-NupkgReleases`
|
||||||
- 运行 `squirrel --releasify` 命令
|
- 运行 `squirrel releasify` 命令
|
||||||
- commit push soft.danmuji.org
|
- commit push soft.danmuji.org
|
||||||
- 修改 `rec.danmuji.org` 上的更新日志
|
- 修改 `rec.danmuji.org` 上的更新日志
|
||||||
|
|
||||||
|
@ -14,11 +14,8 @@
|
||||||
$pkg=""
|
$pkg=""
|
||||||
$dst=""
|
$dst=""
|
||||||
|
|
||||||
$template="$dst/Setup-old.exe"
|
|
||||||
$icon="./BililiveRecorder.WPF/installer.ico"
|
$icon="./BililiveRecorder.WPF/installer.ico"
|
||||||
|
$appIcon="./BililiveRecorder.WPF/ico.ico"
|
||||||
|
|
||||||
mv "$dst/Setup.exe" "$template"
|
squirrel releasify -p "$pkg" -r "$dst" --icon "$icon" --appIcon "$appIcon" -f net472
|
||||||
squirrel --releasify "$pkg" -r "$dst" --setupIcon "$icon" --bootstrapperExe "$template" --framework-version net472 --no-msi
|
|
||||||
|
|
||||||
rm "$template"
|
|
||||||
```
|
```
|
|
@ -382,8 +382,8 @@
|
||||||
<PackageReference Include="Serilog.Sinks.File">
|
<PackageReference Include="Serilog.Sinks.File">
|
||||||
<Version>5.0.0</Version>
|
<Version>5.0.0</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="squirrel.windows">
|
<PackageReference Include="Clowd.Squirrel">
|
||||||
<Version>2.0.1</Version>
|
<Version>2.9.42</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
<PackageReference Include="System.CommandLine">
|
<PackageReference Include="System.CommandLine">
|
||||||
<Version>2.0.0-beta4.22272.1</Version>
|
<Version>2.0.0-beta4.22272.1</Version>
|
||||||
|
|
|
@ -10,7 +10,6 @@
|
||||||
<description>B站录播姬 安装包</description>
|
<description>B站录播姬 安装包</description>
|
||||||
<language>zh-CN</language>
|
<language>zh-CN</language>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<group targetFramework=".NETFramework4.5"/>
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</metadata>
|
</metadata>
|
||||||
<files>
|
<files>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.CommandLine;
|
using System.CommandLine;
|
||||||
using System.CommandLine.NamingConventionBinder;
|
using System.CommandLine.NamingConventionBinder;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
|
@ -22,6 +21,7 @@ using Serilog.Core;
|
||||||
using Serilog.Exceptions;
|
using Serilog.Exceptions;
|
||||||
using Serilog.Formatting.Compact;
|
using Serilog.Formatting.Compact;
|
||||||
using Serilog.Formatting.Display;
|
using Serilog.Formatting.Display;
|
||||||
|
using Squirrel;
|
||||||
|
|
||||||
#nullable enable
|
#nullable enable
|
||||||
namespace BililiveRecorder.WPF
|
namespace BililiveRecorder.WPF
|
||||||
|
@ -114,19 +114,79 @@ namespace BililiveRecorder.WPF
|
||||||
|
|
||||||
var root = new RootCommand("")
|
var root = new RootCommand("")
|
||||||
{
|
{
|
||||||
run,
|
|
||||||
new Option<bool>("--squirrel-firstrun")
|
new Option<bool>("--squirrel-firstrun")
|
||||||
{
|
{
|
||||||
IsHidden = true
|
IsHidden = true
|
||||||
},
|
},
|
||||||
|
new Option<SemanticVersion?>("--squirrel-install")
|
||||||
|
{
|
||||||
|
IsHidden = true,
|
||||||
|
IsRequired = false,
|
||||||
|
},
|
||||||
|
new Option<SemanticVersion?>("--squirrel-updated")
|
||||||
|
{
|
||||||
|
IsHidden = true,
|
||||||
|
IsRequired = false,
|
||||||
|
},
|
||||||
|
new Option<SemanticVersion?>("--squirrel-obsolete")
|
||||||
|
{
|
||||||
|
IsHidden = true,
|
||||||
|
IsRequired = false,
|
||||||
|
},
|
||||||
|
new Option<SemanticVersion?>("--squirrel-uninstall")
|
||||||
|
{
|
||||||
|
IsHidden = true,
|
||||||
|
IsRequired = false,
|
||||||
|
},
|
||||||
|
|
||||||
|
run,
|
||||||
new ToolCommand(),
|
new ToolCommand(),
|
||||||
};
|
};
|
||||||
root.Handler = CommandHandler.Create((bool squirrelFirstrun) => Commands.RunWpfHandler(path: null, squirrelFirstrun: squirrelFirstrun, askPath: false, hide: false));
|
root.Handler = CommandHandler.Create<bool, SemanticVersion?, SemanticVersion?, SemanticVersion?, SemanticVersion?>(Commands.RunRootCommandHandler);
|
||||||
return root;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Commands
|
private static class Commands
|
||||||
{
|
{
|
||||||
|
private static IAppTools GetSquirrelAppTools()
|
||||||
|
{
|
||||||
|
var m = new UpdateManager(updateSource: null, applicationIdOverride: null, localAppDataDirectoryOverride: null);
|
||||||
|
m.Dispose();
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static int RunRootCommandHandler(bool squirrelFirstrun, SemanticVersion? squirrelInstall, SemanticVersion? squirrelUpdated, SemanticVersion? squirrelObsolete, SemanticVersion? squirrelUninstall)
|
||||||
|
{
|
||||||
|
var tools = GetSquirrelAppTools();
|
||||||
|
if (squirrelInstall is not null)
|
||||||
|
{
|
||||||
|
tools.CreateShortcutForThisExe();
|
||||||
|
Environment.Exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (squirrelUpdated is not null)
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (squirrelObsolete is not null)
|
||||||
|
{
|
||||||
|
Environment.Exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else if (squirrelUninstall is not null)
|
||||||
|
{
|
||||||
|
tools.RemoveShortcutForThisExe();
|
||||||
|
Environment.Exit(0);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tools.SetProcessAppUserModelId();
|
||||||
|
return RunWpfHandler(path: null, squirrelFirstrun: squirrelFirstrun, askPath: false, hide: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
internal static int RunWpfHandler(string? path, bool squirrelFirstrun, bool askPath, bool hide)
|
internal static int RunWpfHandler(string? path, bool squirrelFirstrun, bool askPath, bool hide)
|
||||||
{
|
{
|
||||||
Pages.RootPage.CommandArgumentRecorderPath = path;
|
Pages.RootPage.CommandArgumentRecorderPath = path;
|
||||||
|
|
|
@ -10,7 +10,7 @@ using System.Windows;
|
||||||
[assembly: AssemblyConfiguration("")]
|
[assembly: AssemblyConfiguration("")]
|
||||||
[assembly: AssemblyCompany("Genteure")]
|
[assembly: AssemblyCompany("Genteure")]
|
||||||
[assembly: AssemblyProduct("B站录播姬")]
|
[assembly: AssemblyProduct("B站录播姬")]
|
||||||
[assembly: AssemblyCopyright("Copyright © 2018 - 2021 Genteure")]
|
[assembly: AssemblyCopyright("Copyright © 2018 - 2022 Genteure")]
|
||||||
[assembly: AssemblyTrademark("")]
|
[assembly: AssemblyTrademark("")]
|
||||||
[assembly: AssemblyCulture("")]
|
[assembly: AssemblyCulture("")]
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
|
||||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||||
<security>
|
<security>
|
||||||
|
@ -20,4 +21,3 @@
|
||||||
</application>
|
</application>
|
||||||
</compatibility>
|
</compatibility>
|
||||||
</assembly>
|
</assembly>
|
||||||
<!--你在看什么(*゜Д゜*)-->
|
|
|
@ -34,6 +34,12 @@ namespace BililiveRecorder.WPF
|
||||||
{
|
{
|
||||||
using var updateManager = new UpdateManager(@"https://soft.danmuji.org/BililiveRecorder/");
|
using var updateManager = new UpdateManager(@"https://soft.danmuji.org/BililiveRecorder/");
|
||||||
|
|
||||||
|
if (!updateManager.IsInstalledApp)
|
||||||
|
{
|
||||||
|
this.logger.Information("当前不是安装版,不检查是否有新版本。");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var ignoreDeltaUpdates = false;
|
var ignoreDeltaUpdates = false;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
|
@ -43,15 +49,15 @@ namespace BililiveRecorder.WPF
|
||||||
|
|
||||||
if (updateInfo.ReleasesToApply.Count == 0)
|
if (updateInfo.ReleasesToApply.Count == 0)
|
||||||
{
|
{
|
||||||
this.logger.Information("当前运行的是最新版本 {BuildVersion}/{InstalledVersion}",
|
this.logger.Information("当前运行的是最新版本 {BuildVersion} ({InstalledVersion})",
|
||||||
typeof(Update).Assembly.GetName().Version.ToString(4),
|
GitVersionInformation.FullSemVer,
|
||||||
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
|
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.logger.Information("有新版本 {RemoteVersion},当前本地 {BuildVersion}/{InstalledVersion}",
|
this.logger.Information("有新版本 {RemoteVersion},当前本地是 {BuildVersion} ({InstalledVersion})",
|
||||||
updateInfo.FutureReleaseEntry?.Version?.ToString() ?? "×",
|
updateInfo.FutureReleaseEntry?.Version?.ToString() ?? "×",
|
||||||
typeof(Update).Assembly.GetName().Version.ToString(4),
|
GitVersionInformation.FullSemVer,
|
||||||
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
|
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
|
||||||
|
|
||||||
await updateManager.DownloadReleases(updateInfo.ReleasesToApply);
|
await updateManager.DownloadReleases(updateInfo.ReleasesToApply);
|
||||||
|
@ -74,7 +80,7 @@ namespace BililiveRecorder.WPF
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
this.logger.Warning(ex, "检查更新时出错");
|
this.logger.Warning(ex, "检查更新时发生错误");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user