oh-my-posh/packages/scoop/build.ps1

29 lines
1,006 B
PowerShell
Raw Normal View History

2020-10-27 04:10:22 -07:00
Param
(
2020-11-01 02:44:26 -08:00
[parameter(Mandatory = $true)]
2020-10-27 04:10:22 -07:00
[string]
$Version
2020-10-27 04:10:22 -07:00
)
New-Item -Path "." -Name "bin" -ItemType Directory
Copy-Item -Path "../../themes" -Destination "./bin" -Recurse
# Download the files and pack them
@{name = 'posh-windows-amd64.exe'; outName = 'oh-my-posh.exe' }, @{name = 'posh-linux-amd64'; outName = 'oh-my-posh-wsl' } | ForEach-Object -Process {
$download = "https://github.com/jandedobbeleer/oh-my-posh3/releases/download/v$Version/$($_.name)"
Invoke-WebRequest $download -Out "./bin/$($_.outName)"
}
$compress = @{
Path = "./bin/*"
CompressionLevel = "Fastest"
DestinationPath = "./posh-windows-wsl-amd64.7z"
}
Compress-Archive @compress
$zipHash = Get-FileHash ./posh-windows-wsl-amd64.7z -Algorithm SHA256
2020-11-01 04:35:34 -08:00
$content = Get-Content '.\oh-my-posh.json' -Raw
2020-10-27 04:10:22 -07:00
$content = $content.Replace('<VERSION>', $Version)
$content = $content.Replace('<HASH>', $zipHash.Hash)
$content | Out-File -Encoding 'UTF8' './oh-my-posh.json'
Remove-Item ./bin/ -Recurse