update_all.ps1 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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_to
  43. From = $Env:mail_from
  44. Server = $Env:mail_server
  45. UserName = $Env:mail_user
  46. Password = $Env:mail_pass
  47. Port = $Env:mail_port
  48. EnableSsl = $Env:mail_enablessl -eq 'true'
  49. Attachment = "$PSScriptRoot\update_info.xml"
  50. UserMessage = ''
  51. SendAlways = $false #Send notifications every time
  52. }
  53. } else {}
  54. ForcedPackages = $ForcedPackages -split ' '
  55. BeforeEach = {
  56. param($PackageName, $Options )
  57. $p = $Options.ForcedPackages | Where-Object { $_ -match "^${PackageName}(?:\:(.+))*$" }
  58. if (!$p) { return }
  59. [Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseDeclaredVarsMoreThanAssignments', '')]
  60. $global:au_Force = $true
  61. [Diagnostics.CodeAnalysis.SuppressMessageAttribute('UseDeclaredVarsMoreThanAssignments', '')]
  62. $global:au_Version = ($p -split ':')[1]
  63. }
  64. }
  65. [System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor
  66. 768 -bor
  67. [System.Net.SecurityProtocolType]::Tls -bor
  68. [System.Net.SecurityProtocolType]::Ssl3
  69. if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" }
  70. $global:au_Root = $Root #Path to the AU packages
  71. $global:info = updateall -Name $Name -Options $Options
  72. #Uncomment to fail the build on AppVeyor on any package error
  73. #if ($global:info.error_count.total) { throw 'Errors during update' }