fixed worflow errors

This commit is contained in:
Lin Yu-Chieh (Victor) 2024-01-31 22:41:57 +08:00
parent d94a482d33
commit 4e6f85860b

View File

@ -23,8 +23,8 @@ jobs:
$ver = ($response | select-string '"tag_name":').Line.split("`"")[3].Trim('v')
$zip = ($browser | Where-Object { $_ -like "*.zip`"" } | Select-Object -Last 1).Split("`"")[3]
$exe = ($browser | Where-Object { $_ -like "*.exe`"" } | Select-Object -Last 1).Split("`"")[3]
$zip = ($response | Where-Object { $_ -like "*.zip`"" } | Select-Object -Last 1).Split("`"")[3]
$exe = ($response | Where-Object { $_ -like "*.exe`"" } | Select-Object -Last 1).Split("`"")[3]
$pattern = '(?s)(?<=<!--HASH-->).*?(?=<!--ENDHASH-->)'
$hash = (($response | select-string '"body"').Line | Select-String -Pattern $pattern | ForEach-Object { $_.Matches.Value.Trim() }).Split("\r\n")
@ -44,8 +44,16 @@ jobs:
$wingetPackage = "lin-ycv.EverythingPowerToys"
echo $wingetPackage $ver $exe $exehash
rm -Path .\* -Recurse -Force
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
git clone -b winget https://github.com/lin-ycv/EverythingPowerToys.git --depth 1
Invoke-WebRequest https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
cd .\EverythingPowerToys
rm .git -Recurse -Force -Confirm:$false
Get-ChildItem *.* -Recurse | ForEach { (Get-Content $_) | ForEach {$_ -Replace '_VERSION_', $ver} | ForEach {$_ -Replace '_URL_', $exe} | ForEach {$_ -Replace '_CRC_', $exehash} | Set-Content $_ }
.\wingetcreate submit -p "New version: lin-ycv.EverythingPowerToys version $ver" -t ${{ secrets.GITTOKEN }} .\lin-ycv.EverythingPowerToys.yaml
$verArray = $ver -split '\.'
$verArray[1] -= 1
if ($verArray[1] -lt 0) {
$verArray[1] = 0
$verArray[0] -=1
}
$prevVer = $verArray -join '.'
Get-ChildItem *.* -Recurse | ForEach { (Get-Content $_) | ForEach {$_ -Replace '_VERSION_', $ver} | ForEach {$_ -Replace '_URL_', $exe} | ForEach {$_ -Replace '_CRC_', $exehash} | ForEach {$_ -Replace '_PV_', $prevVer} | Set-Content $_ }
..\wingetcreate submit -p "New version: lin-ycv.EverythingPowerToys version $ver" -t ${{ secrets.GITHUB_TOKEN }} .