update.ps1 1.0 KB

1234567891011121314151617181920212223242526272829
  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 | Where-Object href -Match $regex | Select-Object -First 1 -ExpandProperty href)"
  7. $version = $url64 -replace $regex, '$1'
  8. return @{ Version = $version; URL64 = $url64 }
  9. }
  10. function global:au_BeforeUpdate() {
  11. $algorithm = 'sha256'
  12. $Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $algorithm
  13. $Latest.ChecksumType64 = $algorithm
  14. }
  15. function global:au_SearchReplace {
  16. @{
  17. 'tools\chocolateyInstall.ps1' = @{
  18. "(^\s+url64bit\s+=\s+)('.*')" = "`$1'$($Latest.URL64)'"
  19. "(^\s+checksum64\s+=\s+)('.*')" = "`$1'$($Latest.Checksum64)'"
  20. "(^\s+checksumType64\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType64)'"
  21. }
  22. }
  23. }
  24. update -ChecksumFor none