update.ps1 937 B

12345678910111213141516171819202122232425262728
  1. Import-Module au
  2. $repo = 'https://github.com/kubernetes-sigs/aws-iam-authenticator'
  3. function global:au_GetLatest {
  4. $release = Get-LatestReleaseOnGitHub -URL $repo -AccessToken $env:github_api_key
  5. $version = $release.Tag.trim('v.')
  6. $url64 = $release.Assets | Where-Object { $_.FileName -like '*_windows_amd64.exe' } | Select-Object -First 1 -ExpandProperty URL
  7. return @{ Version = $version; URL64 = $url64 }
  8. }
  9. function global:au_BeforeUpdate() {
  10. $algorithm = 'sha256'
  11. $Latest.Checksum64 = Get-RemoteChecksum $Latest.URL64 -Algorithm $algorithm
  12. $Latest.ChecksumType64 = $algorithm
  13. }
  14. function global:au_SearchReplace {
  15. @{
  16. 'tools\chocolateyInstall.ps1' = @{
  17. "(^\s+url64bit\s+=\s+)('.*')" = "`$1'$($Latest.URL64)'"
  18. "(^\s+checksum64\s+=\s+)('.*')" = "`$1'$($Latest.Checksum64)'"
  19. "(^\s+checksumType64\s+=\s+)('.*')" = "`$1'$($Latest.ChecksumType64)'"
  20. }
  21. }
  22. }
  23. update -ChecksumFor none