2021-01-28 12:53:45 -08:00
|
|
|
Param
|
|
|
|
(
|
2021-09-14 09:13:33 -07:00
|
|
|
[parameter(Mandatory = $true)]
|
2022-01-19 01:36:31 -08:00
|
|
|
[ValidateSet('amd64', 'arm64', '386')]
|
2021-09-14 09:13:33 -07:00
|
|
|
[System.String]$Architecture,
|
2021-01-28 12:53:45 -08:00
|
|
|
[parameter(Mandatory = $true)]
|
|
|
|
[string]
|
|
|
|
$Version
|
|
|
|
)
|
|
|
|
|
2022-09-17 14:04:59 -07:00
|
|
|
# Get signing certificate
|
2022-06-19 11:00:31 -07:00
|
|
|
$pfxPath = Join-Path -Path $env:RUNNER_TEMP -ChildPath "cert.pfx"
|
2024-07-09 00:52:49 -07:00
|
|
|
$signtool = 'C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x86/signtool.exe'
|
2022-09-17 14:04:59 -07:00
|
|
|
# create a base64 encoded value of your certificate using
|
|
|
|
# [convert]::ToBase64String((Get-Content -path "certificate.pfx" -AsByteStream))
|
2024-07-09 00:52:49 -07:00
|
|
|
# requires Windows Dev Kit 10.0.22621.0
|
2022-09-17 14:04:59 -07:00
|
|
|
$encodedBytes = [System.Convert]::FromBase64String($env:CERTIFICATE)
|
|
|
|
Set-Content -Path $pfxPath -Value $encodedBytes -AsByteStream
|
2022-06-19 11:00:31 -07:00
|
|
|
|
2021-01-28 12:53:45 -08:00
|
|
|
New-Item -Path "." -Name "bin" -ItemType Directory
|
|
|
|
Copy-Item -Path "../../themes" -Destination "./bin" -Recurse
|
|
|
|
|
2022-09-17 14:04:59 -07:00
|
|
|
# download the executable
|
2022-06-19 11:00:31 -07:00
|
|
|
$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 "./bin/$($name)"
|
|
|
|
|
2021-03-15 09:49:13 -07:00
|
|
|
# license
|
2021-02-15 23:36:37 -08:00
|
|
|
Invoke-WebRequest "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/v$Version/COPYING" -Out "./bin/COPYING.txt"
|
2021-01-28 12:53:45 -08:00
|
|
|
$content = Get-Content '.\oh-my-posh.iss' -Raw
|
|
|
|
$content = $content.Replace('<VERSION>', $Version)
|
2021-09-14 09:13:33 -07:00
|
|
|
$ISSName = ".oh-my-posh-$Architecture-$Version.iss"
|
|
|
|
$content | Out-File -Encoding 'UTF8' $ISSName
|
2022-09-17 14:04:59 -07:00
|
|
|
|
2021-01-28 12:53:45 -08:00
|
|
|
# package content
|
2021-09-14 09:13:33 -07:00
|
|
|
$installer = "install-$Architecture"
|
2022-09-17 14:04:59 -07:00
|
|
|
ISCC.exe /F$installer "/Ssigntool=$signtool sign /f $pfxPath /p $env:CERTIFICATE_PASSWORD /fd SHA256 /t http://timestamp.digicert.com `$f" $ISSName
|
2021-01-28 12:53:45 -08:00
|
|
|
# get hash
|
2021-09-14 09:13:33 -07:00
|
|
|
$zipHash = Get-FileHash "Output/$installer.exe" -Algorithm SHA256
|
|
|
|
$zipHash.Hash | Out-File -Encoding 'UTF8' "Output/$installer.exe.sha256"
|