Skip to content

Commit

Permalink
feat(winget): migrate to MSI
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Nov 25, 2024
1 parent 68edd28 commit 45f4489
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 16 deletions.
32 changes: 19 additions & 13 deletions packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 5 additions & 3 deletions packages/winget/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 45f4489

Please sign in to comment.