update_all.ps1 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. # AU Packages Template: https://github.com/majkinetor/au-packages-template
  2. param([string] $Name, [string] $ForcedPackages, [string] $Root = "$PSScriptRoot\automatic")
  3. if (Test-Path $PSScriptRoot/update_vars.ps1) { . $PSScriptRoot/update_vars.ps1 }
  4. $Options = [ordered]@{
  5. Timeout = 100 #Connection timeout in seconds
  6. UpdateTimeout = 1200 #Update timeout in seconds
  7. Threads = 10 #Number of background jobs to use
  8. Push = $Env:au_Push -eq 'true' #Push to chocolatey
  9. PluginPath = '' #Path to user plugins
  10. Report = @{
  11. Type = 'markdown' #Report type: markdown or text
  12. Path = "$PSScriptRoot\Update-AUPackages.md" #Path where to save the report
  13. Params= @{ #Report parameters:
  14. Github_UserRepo = $Env:github_user_repo # Markdown: shows user info in upper right corner
  15. NoAppVeyor = $false # Markdown: do not show AppVeyor build shield
  16. UserMessage = "[History](#update-history)" # Markdown, Text: Custom user message to show
  17. NoIcons = $false # Markdown: don't show icon
  18. IconSize = 32 # Markdown: icon size
  19. Title = '' # Markdown, Text: TItle of the report, by default 'Update-AUPackages'
  20. }
  21. }
  22. History = @{
  23. Lines = 30 #Number of lines to show
  24. Github_UserRepo = $Env:github_user_repo #User repo to be link to commits
  25. Path = "$PSScriptRoot\Update-History.md" #Path where to save history
  26. }
  27. Gist = @{
  28. Id = $Env:gist_id #Your gist id; leave empty for new private or anonymous gist
  29. ApiKey = $Env:github_api_key #Your github api key - if empty anoymous gist is created
  30. Path = "$PSScriptRoot\Update-AUPackages.md", "$PSScriptRoot\Update-History.md" #List of files to add to the gist
  31. }
  32. Git = @{
  33. User = '' #Git username, leave empty if github api key is used
  34. Password = $Env:github_api_key #Password if username is not empty, otherwise api key
  35. }
  36. RunInfo = @{
  37. Exclude = 'password', 'apikey' #Option keys which contain those words will be removed
  38. Path = "$PSScriptRoot\update_info.xml" #Path where to save the run info
  39. }
  40. Mail = if ($Env:mail_user) {
  41. @{
  42. To = $Env:mail_user
  43. Server = $Env:mail_server
  44. UserName = $Env:mail_user
  45. Password = $Env:mail_pass
  46. Port = $Env:mail_port
  47. EnableSsl = $Env:mail_enablessl -eq 'true'
  48. Attachment = "$PSScriptRoot\update_info.xml"
  49. UserMessage = ''
  50. SendAlways = $false #Send notifications every time
  51. }
  52. } else {}
  53. ForcedPackages = $ForcedPackages -split ' '
  54. BeforeEach = {
  55. param($PackageName, $Options )
  56. $p = $Options.ForcedPackages | ? { $_ -match "^${PackageName}(?:\:(.+))*$" }
  57. if (!$p) { return }
  58. $global:au_Force = $true
  59. $global:au_Version = ($p -split ':')[1]
  60. }
  61. }
  62. [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor
  63. 768 -bor
  64. [System.Net.SecurityProtocolType]::Tls -bor
  65. [System.Net.SecurityProtocolType]::Ssl3
  66. if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" }
  67. $global:au_Root = $Root #Path to the AU packages
  68. $global:info = updateall -Name $Name -Options $Options
  69. #Uncomment to fail the build on AppVeyor on any package error
  70. #if ($global:info.error_count.total) { throw 'Errors during update' }