Skip to content

Commit ebaa20e

Browse files
feat(winget): arm64 support
1 parent 83fc902 commit ebaa20e

File tree

5 files changed

+53
-28
lines changed

5 files changed

+53
-28
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,9 @@ jobs:
239239
needs: [release, artifacts]
240240
if: ${{ needs.release.outputs.skipped == 'false' }}
241241
runs-on: windows-latest
242-
outputs:
243-
hash: ${{ steps.hash.outputs.hash_inno }}
242+
strategy:
243+
matrix:
244+
arch: [amd64, arm64]
244245
defaults:
245246
run:
246247
shell: pwsh
@@ -249,21 +250,21 @@ jobs:
249250
- name: Checkout code
250251
uses: actions/checkout@v2
251252
- name: Build installer
252-
run: ./build.ps1 -Version ${{ needs.release.outputs.version }}
253+
run: ./build.ps1 -Architecture ${{ matrix.arch }} -Version ${{ needs.release.outputs.version }}
253254
- name: Output Hash
254255
id: hash
255256
run: |
256-
$hash = Get-Content -Path Output/install.exe.sha256
257-
Write-Output "::set-output name=hash_inno::$($hash)"
257+
$hash = Get-Content -Path Output/install-${{ matrix.arch }}.exe.sha256
258+
Write-Output "::set-output name=hash_inno_${{ matrix.arch }}::$($hash)"
258259
- name: Upload Inno Installer
259260
id: upload-inno-installer
260261
uses: actions/upload-release-asset@v1
261262
env:
262263
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
263264
with:
264265
upload_url: ${{ needs.release.outputs.upload_url }}
265-
asset_path: ${{ github.workspace }}/packages/inno/Output/install.exe
266-
asset_name: install.exe
266+
asset_path: ${{ github.workspace }}/packages/inno/Output/install-${{ matrix.arch }}.exe
267+
asset_name: install-${{ matrix.arch }}.exe
267268
asset_content_type: text/plain
268269
- name: Upload Inno Installer Hash
269270
id: upload-inno-installer-hash
@@ -272,8 +273,8 @@ jobs:
272273
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
273274
with:
274275
upload_url: ${{ needs.release.outputs.upload_url }}
275-
asset_path: ${{ github.workspace }}/packages/inno/Output/install.exe.sha256
276-
asset_name: install.exe.sha256
276+
asset_path: ${{ github.workspace }}/packages/inno/Output/install-${{ matrix.arch }}.exe.sha256
277+
asset_name: install-${{ matrix.arch }}.exe.sha256
277278
asset_content_type: text/plain
278279
winget:
279280
needs: [release, inno]
@@ -289,4 +290,4 @@ jobs:
289290
- name: Checkout code
290291
uses: actions/checkout@v2
291292
- name: Create manifest and submit PR
292-
run: ./build.ps1 -Version ${{ needs.release.outputs.version }} -Hash ${{ needs.inno.outputs.hash }} -Token $env:WINGETCREATE_TOKEN
293+
run: ./build.ps1 -Version ${{ needs.release.outputs.version }} -Token $env:WINGETCREATE_TOKEN

packages/inno/build.ps1

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Param
22
(
3+
[parameter(Mandatory = $true)]
4+
[ValidateSet('amd64', 'arm64')]
5+
[System.String]$Architecture,
36
[parameter(Mandatory = $true)]
47
[string]
58
$Version
@@ -9,17 +12,19 @@ New-Item -Path "." -Name "bin" -ItemType Directory
912
Copy-Item -Path "../../themes" -Destination "./bin" -Recurse
1013

1114
# download the files and pack them
12-
@{name = 'posh-windows-amd64.exe' }, @{name = 'posh-linux-amd64' }, @{name = 'posh-windows-386.exe' } | ForEach-Object -Process {
13-
$download = "https://github.com/jandedobbeleer/oh-my-posh/releases/download/v$Version/$($_.name)"
15+
@{file = "posh-windows-$Architecture.exe"; name = "oh-my-posh.exe" }, @{file = "posh-linux-$Architecture"; name = "oh-my-posh-wsl" } | ForEach-Object -Process {
16+
$download = "https://github.com/jandedobbeleer/oh-my-posh/releases/download/v$Version/$($_.file)"
1417
Invoke-WebRequest $download -Out "./bin/$($_.name)"
1518
}
1619
# license
1720
Invoke-WebRequest "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$Version/COPYING" -Out "./bin/COPYING.txt"
1821
$content = Get-Content '.\oh-my-posh.iss' -Raw
1922
$content = $content.Replace('<VERSION>', $Version)
20-
$content | Out-File -Encoding 'UTF8' ".oh-my-posh-$Version.iss"
23+
$ISSName = ".oh-my-posh-$Architecture-$Version.iss"
24+
$content | Out-File -Encoding 'UTF8' $ISSName
2125
# package content
22-
ISCC.exe ".oh-my-posh-$Version.iss"
26+
$installer = "install-$Architecture"
27+
ISCC.exe /F$installer $ISSName
2328
# get hash
24-
$zipHash = Get-FileHash 'Output/install.exe' -Algorithm SHA256
25-
$zipHash.Hash | Out-File -Encoding 'UTF8' 'Output/install.exe.sha256'
29+
$zipHash = Get-FileHash "Output/$installer.exe" -Algorithm SHA256
30+
$zipHash.Hash | Out-File -Encoding 'UTF8' "Output/$installer.exe.sha256"

packages/inno/oh-my-posh.iss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ LicenseFile="bin\COPYING.txt"
1111
OutputBaseFilename=install
1212

1313
[Files]
14-
Source: "bin\posh-windows-amd64.exe"; DestDir: "{app}\bin"; DestName: "oh-my-posh.exe"; Flags: 64bit
15-
Source: "bin\posh-windows-386.exe"; DestDir: "{app}\bin"; DestName: "oh-my-posh.exe"; Flags: 32bit
16-
Source: "bin\posh-linux-amd64"; DestDir: "{app}\bin"; DestName: "oh-my-posh-wsl"; Flags: 64bit
14+
Source: "bin\oh-my-posh.exe"; DestDir: "{app}\bin"
15+
Source: "bin\oh-my-posh-wsl"; DestDir: "{app}\bin"
1716
Source: "bin\themes\*"; DestDir: "{app}\themes"
1817

1918
[Registry]

packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ InstallModes:
55
Installers:
66
- Architecture: x64
77
InstallerType: inno
8-
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install.exe
9-
InstallerSha256: <HASH>
8+
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-amd64.exe
9+
InstallerSha256: <HASH-AMD64>
10+
- Architecture: arm64
11+
InstallerType: inno
12+
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.exe
13+
InstallerSha256: <HASH-ARM64>
1014
ManifestType: "installer"
1115
ManifestVersion: 1.0.0

packages/winget/build.ps1

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,25 @@ Param
44
[parameter(Mandatory = $true)]
55
[string]
66
$Version,
7-
[parameter(Mandatory = $true)]
8-
[string]
9-
$Hash,
107
[parameter(Mandatory = $false)]
118
[string]
129
$Token
1310
)
1411

15-
function Set-Version {
12+
function Get-HashForArchitecture {
13+
param (
14+
[parameter(Mandatory = $true)]
15+
[string]
16+
$Architecture,
17+
[parameter(Mandatory = $true)]
18+
[string]
19+
$Version
20+
)
21+
$hash = (new-object Net.WebClient).DownloadString("https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v$Version/install-$Architecture.exe.sha256")
22+
return $hash
23+
}
24+
25+
function Write-MetaData {
1626
param (
1727
[parameter(Mandatory = $true)]
1828
[string]
@@ -22,18 +32,24 @@ function Set-Version {
2232
$Version,
2333
[parameter(Mandatory = $true)]
2434
[string]
25-
$Hash
35+
$HashAmd64,
36+
[parameter(Mandatory = $true)]
37+
[string]
38+
$HashArm64
2639
)
2740
$content = Get-Content $FileName -Raw
2841
$content = $content.Replace('<VERSION>', $Version)
29-
$content = $content.Replace('<HASH>', $Hash)
42+
$content = $content.Replace('<HASH-AMD64>', $HashAmd64)
43+
$content = $content.Replace('<HASH-ARM64>', $HashArm64)
3044
$content | Out-File -Encoding 'UTF8' "./$Version/$FileName"
3145
}
3246

3347
New-Item -Path $PWD -Name $Version -ItemType "directory"
3448
# Get all files inside the folder and adjust the version/hash
49+
$HashAmd64 = Get-HashForArchitecture -Architecture 'amd64' -Version $Version
50+
$HashArm64 = Get-HashForArchitecture -Architecture 'arm64' -Version $Version
3551
Get-ChildItem '*.yaml' | ForEach-Object -Process {
36-
Set-Version -FileName $_.Name -Version $Version -Hash $hash
52+
Write-MetaData -FileName $_.Name -Version $Version -HashAmd64 $HashAmd64 -HashArm64 $HashArm64
3753
}
3854
if (-not $Token) {
3955
return

0 commit comments

Comments
 (0)