Hsiao-nan Cheung e812d3c0e8
chore: Fix checkver.script (#4491)
* chore: Fix `checkver.script`

* trid: Add comment

---------

Co-authored-by: Rashil Gandhi <rashil2000@gmail.com>
2023-02-28 16:55:59 +05:30

40 lines
1.7 KiB
JSON

{
"version": "5.4.0",
"description": "Pester is a test and mock framework for PowerShell.",
"homepage": "https://pester.dev",
"license": "Apache-2.0",
"notes": [
"'Pester' is currently installed as a PS module",
"For more information, visit: 'https://pester.dev/docs/quick-start'"
],
"url": "https://globalcdn.nuget.org/packages/pester.5.4.0.nupkg",
"hash": "3f7f5d306725791f9607f35d8cc7d6d60d259b2dfbd9487e3233587c1f8d767d",
"extract_dir": "tools",
"psmodule": {
"name": "Pester"
},
"checkver": {
"script": [
"# Using checkver script to check through all release tags",
"$auth = Get-GitHubToken",
"$head = @{}",
"if($auth) { $head.add('authorization', \"Bearer $auth\") }",
"$url = 'https://api.github.com/repos/pester/Pester/releases'",
"$latest_ver = [Version]::new(0,0,0,0) # note: Powershell 5 does not support casting 'int' or 'float' to 'System.Version'",
"$releases = $(Invoke-WebRequest -Headers $head $url).Content | ConvertFrom-Json",
"$releases | ForEach-Object {",
" if (!($_.tag_name -match '([\\d.]+)')) { return }",
" if ($_.prerelease) { return }",
" $ver = [Version]::new($matches[1])",
" if ($ver -gt $latest_ver) { $latest_ver = $ver }",
"}",
"if ($latest_ver -eq [Version]::new(0,0,0,0)) { error \"Could not match version string in '$url'\"; continue }",
"Write-Output $latest_ver"
],
"regex": "([\\d.]+)"
},
"autoupdate": {
"url": "https://globalcdn.nuget.org/packages/pester.$version.nupkg"
}
}