feat: add winget package manager support

This commit is contained in:
edde746
2026-03-01 13:11:11 +01:00
parent 3bf7ff3d48
commit 9c7cb7439f
3 changed files with 52 additions and 3 deletions
@@ -1,4 +1,4 @@
name: Update Homebrew Cask
name: Update Packages
on:
release:
@@ -6,7 +6,7 @@ on:
workflow_dispatch:
jobs:
update-cask:
update-homebrew:
runs-on: macos-latest
permissions:
contents: write
@@ -43,3 +43,12 @@ jobs:
else
echo "No cask changes to commit."
fi
update-winget:
runs-on: windows-latest
steps:
- uses: vedantmgoyal9/winget-releaser@v2
with:
identifier: edde746.Plezy
installers-regex: 'plezy-windows-installer\.exe$'
token: ${{ secrets.WINGET_TOKEN }}
+12 -1
View File
@@ -36,7 +36,7 @@ class UpdateService {
static bool get useNativeUpdater {
if (!isUpdateCheckEnabled) return false;
if (Platform.isMacOS) return !_isHomebrewInstall();
if (Platform.isWindows) return _isInstalledApp();
if (Platform.isWindows) return _isInstalledApp() && !_isWingetInstall();
return false;
}
@@ -77,6 +77,17 @@ class UpdateService {
}
}
/// Check if the Windows app was installed via winget.
/// The Inno Setup installer writes a .winget marker file when invoked with /WINGET=1.
static bool _isWingetInstall() {
try {
final exeDir = File(Platform.resolvedExecutable).parent.path;
return File('$exeDir\\.winget').existsSync();
} catch (_) {
return false;
}
}
/// Check if the Windows app is an installed copy (not portable).
/// The Inno Setup installer places unins000.exe next to the executable.
static bool _isInstalledApp() {
+29
View File
@@ -156,6 +156,20 @@ function IsX64: Boolean;
begin
Result := not IsArm64;
end;
procedure CurStepChanged(CurStep: TSetupStep);
var
MarkerPath: String;
begin
if CurStep = ssPostInstall then
begin
MarkerPath := ExpandConstant('{app}\.winget');
if ExpandConstant('{param:WINGET|0}') = '1' then
SaveStringToFile(MarkerPath, '', False)
else
DeleteFile(MarkerPath);
end;
end;
"@
} else {
# Single-arch installer (backward compatible, no Check: functions needed)
@@ -206,6 +220,21 @@ Name: "{autodesktop}\{#Name}"; Filename: "{app}\{#ExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#ExeName}"; Description: "{cm:LaunchProgram,{#Name}}"; Flags: nowait postinstall
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
var
MarkerPath: String;
begin
if CurStep = ssPostInstall then
begin
MarkerPath := ExpandConstant('{app}\.winget');
if ExpandConstant('{param:WINGET|0}') = '1' then
SaveStringToFile(MarkerPath, '', False)
else
DeleteFile(MarkerPath);
end;
end;
"@
}