feat(winget): migrate to MSI

This commit is contained in:
Jan De Dobbeleer 2024-11-24 19:18:10 +01:00 committed by Jan De Dobbeleer
parent 68edd2811d
commit 45f448934c
2 changed files with 24 additions and 16 deletions

View file

@ -4,47 +4,53 @@ ReleaseDate: <DATE>
Platform:
- Windows.Desktop
MinimumOSVersion: 10.0.0.0
InstallerType: inno
InstallerType: msi
InstallModes:
- interactive
- silent
- silentWithProgress
Installers:
- Architecture: x64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-amd64.exe
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x64.msi
InstallerSha256: <HASH-AMD64>
Scope: machine
UpgradeBehavior: install
InstallerSwitches:
Custom: /INSTALLER=winget /ALLUSERS
Custom: INSTALLER=winget ALLUSERS=1
- Architecture: x64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-amd64.exe
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x64.msi
InstallerSha256: <HASH-AMD64>
Scope: user
UpgradeBehavior: install
InstallerSwitches:
Custom: /INSTALLER=winget /CURRENTUSER
Custom: INSTALLER=winget
- Architecture: x86
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-386.exe
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x86.msi
InstallerSha256: <HASH-386>
Scope: machine
UpgradeBehavior: install
InstallerSwitches:
Custom: /INSTALLER=winget /ALLUSERS
Custom: INSTALLER=winget ALLUSERS=1
- Architecture: x86
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-386.exe
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x86.msi
InstallerSha256: <HASH-386>
Scope: user
UpgradeBehavior: install
InstallerSwitches:
Custom: /INSTALLER=winget /CURRENTUSER
Custom: INSTALLER=winget
- Architecture: arm64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.exe
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.msi
InstallerSha256: <HASH-ARM64>
Scope: machine
UpgradeBehavior: install
InstallerSwitches:
Custom: /INSTALLER=winget /ALLUSERS
Custom: INSTALLER=winget ALLUSERS=1
- Architecture: arm64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.exe
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.msi
InstallerSha256: <HASH-ARM64>
Scope: user
UpgradeBehavior: install
InstallerSwitches:
Custom: /INSTALLER=winget /CURRENTUSER
Custom: INSTALLER=winget
ManifestType: installer
ManifestVersion: 1.6.0

View file

@ -18,7 +18,7 @@ function Get-HashForArchitecture {
[string]
$Version
)
$hash = (new-object Net.WebClient).DownloadString("https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v$Version/install-$Architecture.exe.sha256")
$hash = (new-object Net.WebClient).DownloadString("https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v$Version/install-$Architecture.msi.sha256")
return $hash.Trim()
}
@ -52,15 +52,17 @@ function Write-MetaData {
New-Item -Path $PWD -Name $Version -ItemType "directory"
# Get all files inside the folder and adjust the version/hash
$HashAmd64 = Get-HashForArchitecture -Architecture 'amd64' -Version $Version
$HashAmd64 = Get-HashForArchitecture -Architecture 'x64' -Version $Version
$HashArm64 = Get-HashForArchitecture -Architecture 'arm64' -Version $Version
$Hash386 = Get-HashForArchitecture -Architecture '386' -Version $Version
$Hash386 = Get-HashForArchitecture -Architecture 'x86' -Version $Version
Get-ChildItem '*.yaml' | ForEach-Object -Process {
Write-MetaData -FileName $_.Name -Version $Version -HashAmd64 $HashAmd64 -HashArm64 $HashArm64 -Hash386 $Hash386
}
if (-not $Token) {
return
}
# Install the latest wingetcreate exe
# Need to do things this way, see https://github.com/PowerShell/PowerShell/issues/13138
Import-Module Appx -UseWindowsPowerShell