Update version manifest generator to handle tar.gz format correctly

This commit is contained in:
Maxim Lobanov 2020-04-23 19:53:13 +03:00
parent 9f83a0c6de
commit 8312624de3
1 changed files with 14 additions and 1 deletions

View File

@ -41,6 +41,18 @@ if ($PlatformMapFile -and (Test-Path $PlatformMapFile)) {
$PlatformMap = @{} $PlatformMap = @{}
} }
function Get-FileNameWithoutExtension {
param (
[Parameter(Mandatory)][string]$Filename
)
if ($Filename.EndsWith(".tar.gz")) {
$Filename = [IO.path]::GetFileNameWithoutExtension($Filename)
}
return [IO.path]::GetFileNameWithoutExtension($Filename)
}
function New-AssetItem { function New-AssetItem {
param ( param (
[Parameter(Mandatory)][string]$Filename, [Parameter(Mandatory)][string]$Filename,
@ -69,7 +81,8 @@ function Build-AssetsList {
$assets = @() $assets = @()
foreach($releaseAsset in $ReleaseAssets) { foreach($releaseAsset in $ReleaseAssets) {
$parts = [IO.path]::GetFileNameWithoutExtension($releaseAsset.name).Split("-") $filename = Get-FileNameWithoutExtension -Filename $releaseAsset.name
$parts = $filename.Split("-")
$arch = $parts[-1] $arch = $parts[-1]
$buildPlatform = [string]::Join("-", $parts[2..($parts.Length-2)]) $buildPlatform = [string]::Join("-", $parts[2..($parts.Length-2)])