Skip to content

Commit

Permalink
Merge pull request #33 from GewoonJaap/feature/velopack
Browse files Browse the repository at this point in the history
Velpack installer
  • Loading branch information
GewoonJaap authored Oct 12, 2024
2 parents 53d9e63 + 7334a82 commit d5be11e
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 61 deletions.
4 changes: 2 additions & 2 deletions ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<AssemblyName>WinWhisper</AssemblyName>
<ApplicationIcon>WinWhisper-White_Icon.ico</ApplicationIcon>
<Platforms>AnyCPU;ARM64</Platforms>
<Version>1.4.1</Version>
<Version>1.4.4</Version>
<Description>WinWhisper is a Windows application that uses AI to detect and remove background noise from audio files.</Description>
<Authors>Jaap</Authors>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
Expand All @@ -20,8 +20,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Clowd.Squirrel" Version="2.11.1" />
<PackageReference Include="Sentry" Version="4.12.1" />
<PackageReference Include="Velopack" Version="0.0.626" />
</ItemGroup>

<ItemGroup>
Expand Down
60 changes: 25 additions & 35 deletions ConsoleApp/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

using AudioExtractor;
using Data.Model;
using Squirrel;
using System.Reflection;
using System.Runtime.InteropServices;
using Utility;
using Utility.FileSystem;
using Velopack;
using WhisperAI;


Expand Down Expand Up @@ -87,10 +87,10 @@ private static void RegisterSquirrel()
{
return;
}
SquirrelAwareApp.HandleEvents(
onInitialInstall: OnAppInstall,
onAppUninstall: OnAppUninstall,
onEveryRun: OnAppRun);
VelopackApp.Build()
.WithFirstRun(v => Console.WriteLine($"Thanks for installing WinWhisper version {Assembly.GetExecutingAssembly().GetName().Version}"))
.Run();
UpdateMyApp();

Check warning on line 93 in ConsoleApp/Program.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

Check warning on line 93 in ConsoleApp/Program.cs

View workflow job for this annotation

GitHub Actions / build

Because this call is not awaited, execution of the current method continues before the call is completed. Consider applying the 'await' operator to the result of the call.

}

Expand All @@ -117,41 +117,31 @@ private static GatherVideoResult GatherVideosToConvert()

}

private static void OnAppInstall(SemanticVersion version, IAppTools tools)
{
tools.CreateShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop);
}

private static void OnAppUninstall(SemanticVersion version, IAppTools tools)
{
tools.RemoveShortcutForThisExe(ShortcutLocation.StartMenu | ShortcutLocation.Desktop);
}

private static async Task UpdateMyApp()
{
using var mgr = new UpdateManager("https://winwhisper.ams3.digitaloceanspaces.com");
var newVersion = await mgr.UpdateApp();

// optionally restart the app automatically, or ask the user if/when they want to restart
if (newVersion != null)
try
{
Console.WriteLine($"WinWhisper update {newVersion.Version} is available! Installing on exit.");
UpdateManager.RestartAppWhenExited();
}
}
var mgr = new UpdateManager("https://winwhisper.ams3.digitaloceanspaces.com");

private static void OnAppRun(SemanticVersion version, IAppTools tools, bool firstRun)
{
tools.SetProcessAppUserModelId();
// show a welcome message when the app is first installed
if (firstRun)
{
Console.WriteLine($"Thanks for installing WinWhisper version {Assembly.GetExecutingAssembly().GetName().Version}");
if(mgr.IsInstalled == false)
{
return;
}

var newVersion = await mgr.CheckForUpdatesAsync();
if (newVersion == null)
{
return;
}

if (newVersion != null)
{
await mgr.DownloadUpdatesAsync(newVersion);
Console.WriteLine($"WinWhisper update {newVersion.TargetFullRelease.Version} is available! Installing on exit.");
mgr.ApplyUpdatesAndRestart(newVersion);
}
}
try
{
UpdateMyApp();
} catch(Exception ex)
catch (Exception ex)
{
SentrySdk.CaptureException(ex);
}
Expand Down
11 changes: 4 additions & 7 deletions Releases/RELEASES
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
726B1C0315A33BAF0170036E1BFFFED1700F812E WinWhisper-1.2.0-full.nupkg 10960419
5D5C671BBCE88B1E311569C7A2FB6AFD13D2E2D6 WinWhisper-1.2.1-delta.nupkg 3228172
C9C8834AE3D764899E5875FC6848D11EA032C39F WinWhisper-1.2.1-full.nupkg 14122233
9057A41D7995948A75822A517528F9D5658FA38B WinWhisper-1.3.0-delta.nupkg 4610872
3C144554AC0ECE4CA2D9D83A74D00F960CA09F55 WinWhisper-1.3.0-full.nupkg 11142559
50539658D42BF873AFE26465EED228BEB71E23B0 WinWhisper-1.3.1-delta.nupkg 62681
31A02651DA9E3764D39AE1E23526685274F69C9E WinWhisper-1.3.1-full.nupkg 11141945
F8538AAEE78C7F136BA293BB765B0657025E13E8 WinWhisper-1.3.2-delta.nupkg 5983791
5C6D0BEDE33C7F75EF3CC36E51138D68E1E85EA1 WinWhisper-1.3.2-full.nupkg 10690086
CE03BE142BB78C7E800DB4D55A4A7D416927AE36 WinWhisper-1.4.0-delta.nupkg 350620
870EED839886844F3FC9573DFA787E25EF442764 WinWhisper-1.4.0-full.nupkg 10733137
7C658472B1B1AFA6B5B0D5FA4E539EDECB47A098 WinWhisper-1.4.1-delta.nupkg 3599126
8C2D4A95216BA984D9098284252E1FD914AFB0CF WinWhisper-1.4.1-full.nupkg 11816069
96B20FFBB37ECAE757644B461A9DF2A9B6AC460F WinWhisper-1.4.1-full.nupkg 11816743
FD926C3047164CEEE893FD91584B3BAC8F573D92 WinWhisper-1.4.2-full.nupkg 39445113
112A7CBFCAE0538DFC3C1AE57C796C39C5C1FDAE WinWhisper-1.4.3-full.nupkg 39445021
87EACFD8F673AECB5E5927E86A5C81ADB97E3749 WinWhisper-1.4.4-full.nupkg 39445059
Binary file added Releases/WinWhisper-win-Portable.zip
Binary file not shown.
Binary file added Releases/WinWhisper-win-Setup.exe
Binary file not shown.
1 change: 1 addition & 0 deletions Releases/assets.win.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Files":["C:\\Users\\Jaap\\Documents\\GitHub\\WinWhisper\\Releases\\WinWhisper-1.4.4-delta.nupkg","C:\\Users\\Jaap\\Documents\\GitHub\\WinWhisper\\Releases\\WinWhisper-1.4.4-full.nupkg","C:\\Users\\Jaap\\Documents\\GitHub\\WinWhisper\\Releases\\WinWhisper-win-Portable.zip","C:\\Users\\Jaap\\Documents\\GitHub\\WinWhisper\\Releases\\WinWhisper-win-Setup.exe"]}
1 change: 1 addition & 0 deletions Releases/releases.win.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"Assets":[{"PackageId":"WinWhisper","Version":"1.4.4","Type":"Full","FileName":"WinWhisper-1.4.4-full.nupkg","SHA1":"87EACFD8F673AECB5E5927E86A5C81ADB97E3749","SHA256":"D093559F6BE25B97E4B3756FCA8903F887C96673113E045A8695D96B8C3FDFAC","Size":39445059},{"PackageId":"WinWhisper","Version":"1.4.4","Type":"Delta","FileName":"WinWhisper-1.4.4-delta.nupkg","SHA1":"530FA60079A7136C095DF3B330ED22907EA10981","SHA256":"ECD126DA81253B14D8F8F28241B0855D5D468278BB95D6ECC039A14F0691EA4E","Size":115213},{"PackageId":"WinWhisper","Version":"1.4.3","Type":"Full","FileName":"WinWhisper-1.4.3-full.nupkg","SHA1":"112A7CBFCAE0538DFC3C1AE57C796C39C5C1FDAE","SHA256":"DC8D474CCB4B0376E40A3757801D77A972C24D1CBDDA84C9BD83F84BA81608C5","Size":39445021},{"PackageId":"WinWhisper","Version":"1.4.3","Type":"Delta","FileName":"WinWhisper-1.4.3-delta.nupkg","SHA1":"8F8C636C06650565B2C5B59523D506E02E218336","SHA256":"165C5A08C0E8EDADA3DE8A37C57BE55AAE3A610132930FAF24576DC3C748B7D4","Size":115055},{"PackageId":"WinWhisper","Version":"1.4.2","Type":"Full","FileName":"WinWhisper-1.4.2-full.nupkg","SHA1":"FD926C3047164CEEE893FD91584B3BAC8F573D92","SHA256":"1127DB282ECA75F6ECB18B67F3F5D80068986AAA881F9881541A46713A400108","Size":39445113},{"PackageId":"WinWhisper","Version":"1.4.2","Type":"Delta","FileName":"WinWhisper-1.4.2-delta.nupkg","SHA1":"FD926C3047164CEEE893FD91584B3BAC8F573D92","SHA256":"1127DB282ECA75F6ECB18B67F3F5D80068986AAA881F9881541A46713A400108","Size":39445113},{"PackageId":"WinWhisper","Version":"1.4.1","Type":"Full","FileName":"WinWhisper-1.4.1-full.nupkg","SHA1":"96B20FFBB37ECAE757644B461A9DF2A9B6AC460F","SHA256":"F8661CAD2A2A6EE006E2D43FDDBE81370D9A5E58DB0E48256BD032398B22AF83","Size":11816743},{"PackageId":"WinWhisper","Version":"1.4.1","Type":"Delta","FileName":"WinWhisper-1.4.1-delta.nupkg","SHA1":"D32D0E4B63EEDEA2B72D5B3CA7883C3D15F19DE1","SHA256":"2E2C35E78FEB002DC5D61CCFE5DB67B6951E81A1C4A2B1F4E3A70CE320AD5451","Size":3599801},{"PackageId":"WinWhisper","Version":"1.4.0","Type":"Full","FileName":"WinWhisper-1.4.0-full.nupkg","SHA1":"870EED839886844F3FC9573DFA787E25EF442764","SHA256":"AA1B0277E510096EB910F7F39FBBAF9DF2A9271BBBDCCECE87C42A9461CEB4A9","Size":10733137},{"PackageId":"WinWhisper","Version":"1.4.0","Type":"Delta","FileName":"WinWhisper-1.4.0-delta.nupkg","SHA1":"CE03BE142BB78C7E800DB4D55A4A7D416927AE36","SHA256":"03EF344D1E9696B4A2AF75B41CE1F21BA6D8AD1B8F8763A1415B257759B57818","Size":350620},{"PackageId":"WinWhisper","Version":"1.3.2","Type":"Full","FileName":"WinWhisper-1.3.2-full.nupkg","SHA1":"5C6D0BEDE33C7F75EF3CC36E51138D68E1E85EA1","SHA256":"98D907FFAF45AB3DA37670F2213ADEFAFD8BA0BF4EC3DD0EF7C0BF6D3DEA8837","Size":10690086},{"PackageId":"WinWhisper","Version":"1.3.2","Type":"Delta","FileName":"WinWhisper-1.3.2-delta.nupkg","SHA1":"F8538AAEE78C7F136BA293BB765B0657025E13E8","SHA256":"65037AEA7D53E73D1C6E4C2BC253A92550249B119864DDF51250F117A4EB3F7C","Size":5983791},{"PackageId":"WinWhisper","Version":"1.3.1","Type":"Full","FileName":"WinWhisper-1.3.1-full.nupkg","SHA1":"31A02651DA9E3764D39AE1E23526685274F69C9E","SHA256":"484D616FA614DD1763808E55208C74B3D6AD893A9B0AE68D58AE0586FE5A285F","Size":11141945},{"PackageId":"WinWhisper","Version":"1.3.1","Type":"Delta","FileName":"WinWhisper-1.3.1-delta.nupkg","SHA1":"50539658D42BF873AFE26465EED228BEB71E23B0","SHA256":"A9AB754B1577EFA7CB8AE3E07F2090AE05FAABFBBE81F1C132822036BE9A3115","Size":62681},{"PackageId":"WinWhisper","Version":"1.3.0","Type":"Full","FileName":"WinWhisper-1.3.0-full.nupkg","SHA1":"3C144554AC0ECE4CA2D9D83A74D00F960CA09F55","SHA256":"3C58AA1333D6799A00EF33F432AF8AB9BBFF047C35A03C7F003502B8BD9C20F4","Size":11142559},{"PackageId":"WinWhisper","Version":"1.3.0","Type":"Delta","FileName":"WinWhisper-1.3.0-delta.nupkg","SHA1":"9057A41D7995948A75822A517528F9D5658FA38B","SHA256":"FFD04A831460DD55B3E13903ACED398051E677437BADDBBA4CB7CA99647A590F","Size":4610872},{"PackageId":"WinWhisper","Version":"1.2.1","Type":"Full","FileName":"WinWhisper-1.2.1-full.nupkg","SHA1":"C9C8834AE3D764899E5875FC6848D11EA032C39F","SHA256":"F21B676F2C5C255B84643B7B232C82E456282532D90F676543935F1E94701A6A","Size":14122233},{"PackageId":"WinWhisper","Version":"1.2.1","Type":"Delta","FileName":"WinWhisper-1.2.1-delta.nupkg","SHA1":"5D5C671BBCE88B1E311569C7A2FB6AFD13D2E2D6","SHA256":"0F911386CB6475E8A76BD916FEE4EEF696DFD6840DECCEC7BC911AC66095EEFA","Size":3228172},{"PackageId":"WinWhisper","Version":"1.2.0","Type":"Full","FileName":"WinWhisper-1.2.0-full.nupkg","SHA1":"726B1C0315A33BAF0170036E1BFFFED1700F812E","SHA256":"DE824D553C2FAD6795F329AB326B541F214C1835ECBEA3AC2C0411F5EF3EC469","Size":10960419}]}
38 changes: 21 additions & 17 deletions publish.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,36 @@ if exist ".\Publish" (
)
mkdir ".\Publish"

:: Ask for the new version number
set /p version="New version number (e.g. 1.0.0): "

:: Install VeloPack (vpk) tool
dotnet tool update -g vpk

set /p version="New version number (e.g. 1.0.0): "
dotnet publish -c Release -o ".\Publish" /p:AssemblyVersion=%version% /p:FileVersion=%version% /p:InformationalVersion=%version%
:: Ensure the global tools path is in the PATH environment variable
set PATH=%PATH%;%USERPROFILE%\.dotnet\tools

:: Set the path to Squirrel.exe
set SQUIRREL_PATH=.\SquirrelTools\Squirrel.exe
:: Publish the .NET application
dotnet publish -c Release --self-contained -r win-x64 -o ".\Publish" /p:AssemblyVersion=%version% /p:FileVersion=%version% /p:InformationalVersion=%version%

:: Download the currently live version
%SQUIRREL_PATH% http-down --url "https://winwhisper.ams3.digitaloceanspaces.com"
:: Set the URL for downloading the currently live version
set LIVE_VERSION_URL=https://winwhisper.ams3.digitaloceanspaces.com

:: Ask for the new version number
:: Download the currently live version
vpk download http --url "%LIVE_VERSION_URL%"

:: Build new version and delta updates
%SQUIRREL_PATH% pack ^
--framework net7,vcredist143-x86 ^
--packId "WinWhisper" ^
--packVersion %version% ^
--packAuthors "Jaap" ^
--packDir ".\Publish" ^
--icon ".\ConsoleApp\WinWhisper-White_Icon.ico" ^
--splashImage ".\Assets\Cover\1x\WinWhisper-Blue_Cover.png" ^
--releaseDir ".\Releases"
vpk pack ^
-u "WinWhisper" ^
-v "%version%" ^
-p ".\Publish" ^
-e "WinWhisper.exe" ^
-i ".\ConsoleApp\WinWhisper-White_Icon.ico" ^
-s ".\Assets\Cover\1x\WinWhisper-Blue_Cover.png" ^
-o ".\Releases"

:: Create a .isStandalone file in the Publish directory to indicate that this is a standalone release
echo 1 > .\Publish\.isStandalone

:: Zip all files in Publish to WinWHisper-<version>-standalone.zip
:: Zip all files in Publish to WinWhisper-%version%-standalone.zip
powershell Compress-Archive -Path ".\Publish\*" -DestinationPath ".\Publish\WinWhisper-%version%-standalone.zip"

0 comments on commit d5be11e

Please sign in to comment.