-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathupdate.ps1
31 lines (23 loc) · 1.02 KB
/
update.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import-module chocolatey-au
$releases = 'https://github.com/Tracktion/pluginval/releases'
function global:au_SearchReplace {
@{
'tools\chocolateyInstall.ps1' = @{
"(^[$]url64\s*=\s*)('.*')" = "`$1'$($Latest.URL64)'"
"(^[$]checksum64\s*=\s*)('.*')" = "`$1'$($Latest.Checksum64)'"
}
}
}
function global:au_GetLatest {
$releases_page = Invoke-WebRequest -Uri $releases -UseBasicParsing
$release_tag_url = "https://github.com" + ($releases_page.Links.Href -match "/tag/" | Select-Object -First 1)
$expanded_assets_url = $release_tag_url -replace "/tag/","/expanded_assets/"
$assets_page = Invoke-WebRequest -Uri $expanded_assets_url -UseBasicParsing
$re = "pluginval_Windows.zip$"
$url = $assets_page.Links.Href -match $re | Select-Object -First 1
$version = $url -split '/' -replace 'v','' | Select-Object -Last 1 -Skip 1
$url64 = 'https://github.com' + $url
$Latest = @{ URL64 = $url64; Version = $version }
return $Latest
}
update -ChecksumFor 64