-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.ps1
28 lines (23 loc) · 945 Bytes
/
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
Import-Module au
$repo = 'https://github.com/kubernetes-sigs/aws-iam-authenticator'
function global:au_GetLatest {
$release = Get-LatestReleaseOnGitHub -URL $repo -AccessToken $env:github_api_key
$version = $release.Tag.trim('v.')
$url64 = $release.Assets | Where-Object { $_.FileName -like '*_windows_amd64.exe' } | Select-Object -First 1 -ExpandProperty DownloadURL
return @{ Version = $version; URL64 = $url64 }
}
function global:au_BeforeUpdate() {
$algorithm = 'sha256'
$Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $algorithm
$Latest.ChecksumType64 = $algorithm
}
function global:au_SearchReplace {
@{
'tools\chocolateyInstall.ps1' = @{
"(^\s+url64bit\s+=\s+)('.*')" = "`$1'$($Latest.URL64)'"
"(^\s+checksum64\s+=\s+)('.*')" = "`$1'$($Latest.Checksum64)'"
"(^\s+checksumType64\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType64)'"
}
}
}
update -ChecksumFor none