mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-01-11 11:17:27 -08:00
feat(install): add msi
This commit is contained in:
parent
7bc0c4e781
commit
6bc8756e27
53
.github/workflows/msi.yml
vendored
Normal file
53
.github/workflows/msi.yml
vendored
Normal file
|
@ -0,0 +1,53 @@
|
|||
name: MSI
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
jobs:
|
||||
package:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
arch: [x64, arm64, x86]
|
||||
defaults:
|
||||
run:
|
||||
shell: pwsh
|
||||
working-directory: ${{ github.workspace }}/packages/inno
|
||||
steps:
|
||||
- name: Checkout code 👋
|
||||
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
|
||||
- name: Build installer 📦
|
||||
id: build
|
||||
env:
|
||||
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
|
||||
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
|
||||
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
|
||||
run: |
|
||||
$version = $env:GITHUB_REF.TrimStart("refs/tags/v")
|
||||
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Sign
|
||||
- name: Upload artifacts 🆙
|
||||
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
|
||||
with:
|
||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||
script: |
|
||||
console.log('environment', process.versions);
|
||||
|
||||
const fs = require('fs').promises;
|
||||
|
||||
const { repo: { owner, repo }, sha } = context;
|
||||
console.log({ owner, repo, sha });
|
||||
|
||||
for (let file of await fs.readdir('./packages/msi/out')) {
|
||||
if (file.indexOf(".msi") < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
console.log('uploading', file);
|
||||
|
||||
await github.rest.repos.uploadReleaseAsset({
|
||||
owner, repo,
|
||||
release_id: ${{ github.event.release.id }},
|
||||
name: file,
|
||||
data: await fs.readFile(`./packages/msi/out/${file}`)
|
||||
});
|
||||
}
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -4,6 +4,8 @@
|
|||
src/test/umbraco/obj/
|
||||
src/keys
|
||||
*.prof
|
||||
*.wixpdb
|
||||
packages/msi/Microsoft.Trusted.Signing.Client
|
||||
|
||||
# Created by https://www.toptal.com/developers/gitignore/api/node,go,visualstudiocode
|
||||
# Edit at https://www.toptal.com/developers/gitignore?templates=node,go,visualstudiocode
|
||||
|
|
|
@ -5,7 +5,10 @@ Param
|
|||
[System.String]$Architecture,
|
||||
[parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$Version
|
||||
$Version,
|
||||
[parameter(Mandatory = $false)]
|
||||
[string]
|
||||
$SDKVersion = "10.0.22621.0"
|
||||
)
|
||||
|
||||
$PSDefaultParameterValues['Out-File:Encoding']='UTF8'
|
||||
|
@ -13,9 +16,9 @@ $PSDefaultParameterValues['Out-File:Encoding']='UTF8'
|
|||
# setup dependencies
|
||||
nuget.exe install Microsoft.Trusted.Signing.Client -Version 1.0.60 -x
|
||||
$signtoolDlib = "$PWD/Microsoft.Trusted.Signing.Client/bin/x64/Azure.CodeSigning.Dlib.dll"
|
||||
$signtool = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/signtool.exe'
|
||||
$signtool = "C:/Program Files (x86)/Windows Kits/10/bin/$SDKVersion/x64/signtool.exe"
|
||||
|
||||
New-Item -Path "." -Name "bin" -ItemType Directory
|
||||
New-Item -Path "." -Name "bin" -ItemType Directory -ErrorAction SilentlyContinue
|
||||
Copy-Item -Path "../../themes" -Destination "./bin" -Recurse
|
||||
|
||||
# download the executable
|
||||
|
|
40
packages/msi/README.md
Normal file
40
packages/msi/README.md
Normal file
|
@ -0,0 +1,40 @@
|
|||
# MSI Package
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [dotnet]
|
||||
- [wix]: `dotnet tool install --global wix`
|
||||
|
||||
## Build the package
|
||||
|
||||
This guide assumes and advices the use of PowerShell as your shell environment for this purpose.
|
||||
|
||||
### Set the environment variables
|
||||
|
||||
```powershell
|
||||
$env:VERSION = "1.3.37"
|
||||
$env:INSTALLER= "msi"
|
||||
```
|
||||
|
||||
### Build the installer
|
||||
|
||||
```powershell
|
||||
wix build -arch arm64 -out install-arm64.msi
|
||||
```
|
||||
|
||||
## Install the package
|
||||
|
||||
### For the current user
|
||||
|
||||
```powershell
|
||||
install-arm64.msi
|
||||
```
|
||||
|
||||
### For all users
|
||||
|
||||
```powershell
|
||||
install-arm64.msi ALLUSERS=1
|
||||
```
|
||||
|
||||
[dotnet]: https://dotnet.microsoft.com/en-us/download/dotnet?cid=getdotnetcorecli
|
||||
[wix]: https://wixtoolset.org/docs/intro/
|
56
packages/msi/build.ps1
Normal file
56
packages/msi/build.ps1
Normal file
|
@ -0,0 +1,56 @@
|
|||
Param
|
||||
(
|
||||
[parameter(Mandatory = $true)]
|
||||
[ValidateSet('x64', 'arm64', 'x86')]
|
||||
[System.String]$Architecture,
|
||||
[parameter(Mandatory = $true)]
|
||||
[string]
|
||||
$Version,
|
||||
[parameter(Mandatory = $false)]
|
||||
[string]
|
||||
$SDKVersion = "10.0.22621.0",
|
||||
[parameter(Mandatory = $false)]
|
||||
[boolean]
|
||||
$Download = $true,
|
||||
[parameter(Mandatory = $false)]
|
||||
[boolean]
|
||||
$Sign = $false
|
||||
)
|
||||
|
||||
$PSDefaultParameterValues['Out-File:Encoding'] = 'UTF8'
|
||||
|
||||
New-Item -Path "." -Name "dist" -ItemType Directory -ErrorAction SilentlyContinue
|
||||
New-Item -Path "." -Name "out" -ItemType Directory -ErrorAction SilentlyContinue
|
||||
|
||||
if ($Download) {
|
||||
# download the executable
|
||||
$file = "posh-windows-$Architecture.exe"
|
||||
$name = "oh-my-posh.exe"
|
||||
$download = "https://github.com/jandedobbeleer/oh-my-posh/releases/download/v$Version/$($file)"
|
||||
Invoke-WebRequest $download -Out "./dist/$($name)"
|
||||
}
|
||||
|
||||
# variables
|
||||
$env:VERSION = $Version
|
||||
|
||||
# create MSI
|
||||
$installer = "./out/install-$Architecture.msi"
|
||||
wix build -arch $Architecture -out $installer .\oh-my-posh.wxs
|
||||
|
||||
if ($Sign) {
|
||||
# setup dependencies
|
||||
nuget.exe install Microsoft.Trusted.Signing.Client -Version 1.0.60 -x
|
||||
$signtoolDlib = "$PWD/Microsoft.Trusted.Signing.Client/bin/x64/Azure.CodeSigning.Dlib.dll"
|
||||
$signtool = "C:/Program Files (x86)/Windows Kits/10/bin/$SDKVersion/x64/signtool.exe"
|
||||
|
||||
# clean paths
|
||||
$signtool = $signtool -Replace '\\', '/'
|
||||
$signtoolDlib = $signtoolDlib -Replace '\\', '/'
|
||||
|
||||
# sign installer
|
||||
& "$signtool" sign /v /debug /fd SHA256 /tr 'http://timestamp.acs.microsoft.com' /td SHA256 /dlib "$signtoolDlib" /dmdf ../../src/metadata.json $installer
|
||||
}
|
||||
|
||||
# get hash
|
||||
$zipHash = Get-FileHash $installer -Algorithm SHA256
|
||||
$zipHash.Hash | Out-File -Encoding 'UTF8' "$installer.sha256"
|
BIN
packages/msi/icon.ico
Normal file
BIN
packages/msi/icon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
41
packages/msi/oh-my-posh.wxs
Normal file
41
packages/msi/oh-my-posh.wxs
Normal file
|
@ -0,0 +1,41 @@
|
|||
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
|
||||
<Package Language="1033" Manufacturer="Jan De Dobbeleer" Name="Oh My Posh" UpgradeCode="b2a6bcaa-bda3-4c7f-8dec-d8665d7a9b69" Version="$(env.VERSION)" UpgradeStrategy="none" Scope="perUserOrMachine">
|
||||
<SummaryInformation Description="https://ohmyposh.dev" />
|
||||
<Icon Id="icon.ico" SourceFile="icon.ico" />
|
||||
<Property Id="ARPPRODUCTICON" Value="icon.ico" />
|
||||
<Property Id="INSTALLER" Value="manual" />
|
||||
<MediaTemplate EmbedCab="yes" />
|
||||
<StandardDirectory Id="ProgramFilesFolder">
|
||||
<Directory Id="ParentInstallDir" Name="oh-my-posh">
|
||||
<Directory Id="INSTALLDIR" Name="bin" />
|
||||
<Directory Id="THEMESDIR" Name="themes" />
|
||||
</Directory>
|
||||
</StandardDirectory>
|
||||
<Feature Id="Installation" AllowAbsent="no" Description="https://ohmyposh.dev" Title="Oh My Posh">
|
||||
<ComponentGroupRef Id="Files" />
|
||||
<ComponentGroupRef Id="EnvironmentVariables" />
|
||||
</Feature>
|
||||
</Package>
|
||||
<Fragment>
|
||||
<ComponentGroup Id="Files">
|
||||
<Component Id="Executable" Directory="INSTALLDIR">
|
||||
<File Source="dist/oh-my-posh.exe" />
|
||||
</Component>
|
||||
<Files Directory="THEMESDIR" Include="../../themes/*.omp.*" />
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
<Fragment>
|
||||
<ComponentGroup Id="EnvironmentVariables">
|
||||
<Component Id="SystemEnvironmentVariables" Condition="ALLUSERS=1" Directory="INSTALLDIR" Guid="ee903196-9032-4592-b461-25c96823bed7">
|
||||
<Environment Id="SystemPath" Action="set" Name="Path" Part="first" Permanent="no" System="yes" Value="[INSTALLDIR]" />
|
||||
<Environment Id="SystemThemesDir" Action="set" Name="POSH_THEMES_PATH" Part="all" Permanent="no" System="yes" Value="[THEMESDIR]" />
|
||||
<Environment Id="SystemInstaller" Action="set" Name="POSH_INSTALLER" Part="all" Permanent="no" System="yes" Value="[INSTALLER]" />
|
||||
</Component>
|
||||
<Component Id="UserEnvironmentVariables" Condition="NOT ALLUSERS" Directory="INSTALLDIR" Guid="212dc904-b134-45b6-a647-a05ce417684a">
|
||||
<Environment Id="UserPath" Action="set" Name="Path" Part="first" Permanent="no" System="no" Value="[INSTALLDIR]" />
|
||||
<Environment Id="UserThemesDir" Action="set" Name="POSH_THEMES_PATH" Part="all" Permanent="no" System="no" Value="[THEMESDIR]" />
|
||||
<Environment Id="UserInstaller" Action="set" Name="POSH_INSTALLER" Part="all" Permanent="no" System="no" Value="[INSTALLER]" />
|
||||
</Component>
|
||||
</ComponentGroup>
|
||||
</Fragment>
|
||||
</Wix>
|
Loading…
Reference in a new issue