pester: Add checkver script

* Add checkver script that checks all release tags (similar to `main/pnpm`)
* Pester mixes ver4 and ver5 in their releases. This will prevent the "wrong revert" error preemptively.
This commit is contained in:
Issac Lin 2022-07-08 21:00:15 +08:00 committed by GitHub
parent 06ffaa7eb8
commit 692b4b8a8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,20 @@
"name": "Pester"
},
"checkver": {
"github": "https://github.com/pester/Pester"
"script": [
"# Using checkver script to check through all release tags",
"$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 $url).Content | ConvertFrom-Json",
"$releases | ForEach-Object {",
" if (!($_.tag_name -match '([\\d.]+)')) { 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'\"; break }",
"Write-Output $latest_ver"
],
"regex": "([\\d.]+)"
},
"autoupdate": {
"url": "https://globalcdn.nuget.org/packages/pester.$version.nupkg"