mirror of
https://github.com/BililiveRecorder/BililiveRecorder.git
synced 2024-11-16 03:32:20 +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 Actions 会自动补充 Assets
|
||||
- 从 Artifacts 里下载 `WPF-NupkgReleases`
|
||||
- 运行 `squirrel --releasify` 命令
|
||||
- 运行 `squirrel releasify` 命令
|
||||
- commit push soft.danmuji.org
|
||||
- 修改 `rec.danmuji.org` 上的更新日志
|
||||
|
||||
|
@ -14,11 +14,8 @@
|
|||
$pkg=""
|
||||
$dst=""
|
||||
|
||||
$template="$dst/Setup-old.exe"
|
||||
$icon="./BililiveRecorder.WPF/installer.ico"
|
||||
$appIcon="./BililiveRecorder.WPF/ico.ico"
|
||||
|
||||
mv "$dst/Setup.exe" "$template"
|
||||
squirrel --releasify "$pkg" -r "$dst" --setupIcon "$icon" --bootstrapperExe "$template" --framework-version net472 --no-msi
|
||||
|
||||
rm "$template"
|
||||
squirrel releasify -p "$pkg" -r "$dst" --icon "$icon" --appIcon "$appIcon" -f net472
|
||||
```
|
|
@ -382,8 +382,8 @@
|
|||
<PackageReference Include="Serilog.Sinks.File">
|
||||
<Version>5.0.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="squirrel.windows">
|
||||
<Version>2.0.1</Version>
|
||||
<PackageReference Include="Clowd.Squirrel">
|
||||
<Version>2.9.42</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="System.CommandLine">
|
||||
<Version>2.0.0-beta4.22272.1</Version>
|
||||
|
@ -411,4 +411,4 @@
|
|||
</PropertyGroup>
|
||||
<Exec Command="$(PkgNuGet_CommandLine)\tools\NuGet pack BililiveRecorder.nuspec -Version %(myAssemblyInfo.Version) -Properties Configuration=Release -OutputDirectory $(NupkgReleaseDir) -BasePath $(OutDir) -NonInteractive -ForceEnglishOutput" />
|
||||
</Target>
|
||||
</Project>
|
||||
</Project>
|
||||
|
|
|
@ -1,28 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||
<metadata>
|
||||
<id>BililiveRecorder</id>
|
||||
<version>0.0.0</version>
|
||||
<title>B站录播姬</title>
|
||||
<authors>Genteure</authors>
|
||||
<owners>Genteure</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>B站录播姬 安装包</description>
|
||||
<language>zh-CN</language>
|
||||
<dependencies>
|
||||
<group targetFramework=".NETFramework4.5"/>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="*" target="lib\net45\" exclude="*.nupkg;*.vshost.*;*.log;*.txt;NuGet.Squirrel.pdb"/>
|
||||
<file src="lib\*" target="lib\net45\lib\"/>
|
||||
<file src="zh-Hans\*" target="lib\net45\zh-Hans\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="zh-Hant\*" target="lib\net45\zh-Hant\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="zh-CN\*" target="lib\net45\zh-CN\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="zh-TW\*" target="lib\net45\zh-TW\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="en\*" target="lib\net45\en\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="en-PN\*" target="lib\net45\en-PN\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="ja\*" target="lib\net45\ja\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="ja-JP\*" target="lib\net45\ja-JP\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
</files>
|
||||
<metadata>
|
||||
<id>BililiveRecorder</id>
|
||||
<version>0.0.0</version>
|
||||
<title>B站录播姬</title>
|
||||
<authors>Genteure</authors>
|
||||
<owners>Genteure</owners>
|
||||
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||
<description>B站录播姬 安装包</description>
|
||||
<language>zh-CN</language>
|
||||
<dependencies>
|
||||
</dependencies>
|
||||
</metadata>
|
||||
<files>
|
||||
<file src="*" target="lib\net45\" exclude="*.nupkg;*.vshost.*;*.log;*.txt;NuGet.Squirrel.pdb"/>
|
||||
<file src="lib\*" target="lib\net45\lib\"/>
|
||||
<file src="zh-Hans\*" target="lib\net45\zh-Hans\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="zh-Hant\*" target="lib\net45\zh-Hant\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="zh-CN\*" target="lib\net45\zh-CN\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="zh-TW\*" target="lib\net45\zh-TW\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="en\*" target="lib\net45\en\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="en-PN\*" target="lib\net45\en-PN\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="ja\*" target="lib\net45\ja\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
<file src="ja-JP\*" target="lib\net45\ja-JP\" exclude="**\*.nupkg;**\*.vshost.*;**\*.log;**\*.txt;**\Microsoft.VisualStudio.Threading.resources.dll;**\Microsoft.VisualStudio.Validation.resources.dll"/>
|
||||
</files>
|
||||
</package>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.CommandLine;
|
||||
using System.CommandLine.NamingConventionBinder;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
|
@ -22,6 +21,7 @@ using Serilog.Core;
|
|||
using Serilog.Exceptions;
|
||||
using Serilog.Formatting.Compact;
|
||||
using Serilog.Formatting.Display;
|
||||
using Squirrel;
|
||||
|
||||
#nullable enable
|
||||
namespace BililiveRecorder.WPF
|
||||
|
@ -114,19 +114,79 @@ namespace BililiveRecorder.WPF
|
|||
|
||||
var root = new RootCommand("")
|
||||
{
|
||||
run,
|
||||
new Option<bool>("--squirrel-firstrun")
|
||||
{
|
||||
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(),
|
||||
};
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
Pages.RootPage.CommandArgumentRecorderPath = path;
|
||||
|
|
|
@ -10,7 +10,7 @@ using System.Windows;
|
|||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Genteure")]
|
||||
[assembly: AssemblyProduct("B站录播姬")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018 - 2021 Genteure")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018 - 2022 Genteure")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[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">
|
||||
<SquirrelAwareVersion xmlns="urn:schema-squirrel-com:asm.v1">1</SquirrelAwareVersion>
|
||||
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
|
||||
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
|
||||
<security>
|
||||
|
@ -20,4 +21,3 @@
|
|||
</application>
|
||||
</compatibility>
|
||||
</assembly>
|
||||
<!--你在看什么(*゜Д゜*)-->
|
|
@ -34,6 +34,12 @@ namespace BililiveRecorder.WPF
|
|||
{
|
||||
using var updateManager = new UpdateManager(@"https://soft.danmuji.org/BililiveRecorder/");
|
||||
|
||||
if (!updateManager.IsInstalledApp)
|
||||
{
|
||||
this.logger.Information("当前不是安装版,不检查是否有新版本。");
|
||||
return;
|
||||
}
|
||||
|
||||
var ignoreDeltaUpdates = false;
|
||||
|
||||
retry:
|
||||
|
@ -43,15 +49,15 @@ namespace BililiveRecorder.WPF
|
|||
|
||||
if (updateInfo.ReleasesToApply.Count == 0)
|
||||
{
|
||||
this.logger.Information("当前运行的是最新版本 {BuildVersion}/{InstalledVersion}",
|
||||
typeof(Update).Assembly.GetName().Version.ToString(4),
|
||||
this.logger.Information("当前运行的是最新版本 {BuildVersion} ({InstalledVersion})",
|
||||
GitVersionInformation.FullSemVer,
|
||||
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
|
||||
}
|
||||
else
|
||||
{
|
||||
this.logger.Information("有新版本 {RemoteVersion},当前本地 {BuildVersion}/{InstalledVersion}",
|
||||
this.logger.Information("有新版本 {RemoteVersion},当前本地是 {BuildVersion} ({InstalledVersion})",
|
||||
updateInfo.FutureReleaseEntry?.Version?.ToString() ?? "×",
|
||||
typeof(Update).Assembly.GetName().Version.ToString(4),
|
||||
GitVersionInformation.FullSemVer,
|
||||
updateInfo.CurrentlyInstalledVersion?.Version?.ToString() ?? "×");
|
||||
|
||||
await updateManager.DownloadReleases(updateInfo.ReleasesToApply);
|
||||
|
@ -74,7 +80,7 @@ namespace BililiveRecorder.WPF
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
this.logger.Warning(ex, "检查更新时出错");
|
||||
this.logger.Warning(ex, "检查更新时发生错误");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user