update.ps1 862 B

1234567891011121314151617181920212223
  1. Import-Module au
  2. $latest_release = 'https://github.com/kubernetes-sigs/aws-iam-authenticator/releases/latest'
  3. function global:au_GetLatest {
  4. $download_page = Invoke-WebRequest -Uri $latest_release -UseBasicParsing
  5. $regex = '^.+/aws-iam-authenticator_(\d+\.\d+\.\d+)_windows_amd64\.exe$'
  6. $url64 = "https://github.com$($download_page.Links | ? href -Match $regex | select -First 1 -ExpandProperty href)"
  7. $version = $url64 -replace $regex, '$1'
  8. return @{ Version = $version; URL64 = $url64 }
  9. }
  10. function global:au_SearchReplace {
  11. @{
  12. 'tools\chocolateyInstall.ps1' = @{
  13. "(^\s+url64bit\s+=\s+)('.*')" = "`$1'$($Latest.URL64)'"
  14. "(^\s+checksum64\s+=\s+)('.*')" = "`$1'$($Latest.Checksum64)'"
  15. "(^\s+checksumType64\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType64)'"
  16. }
  17. }
  18. }
  19. update -ChecksumFor 64