update_all.ps1 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" }
  63. $global:au_Root = $Root #Path to the AU packages
  64. $global:info = updateall -Name $Name -Options $Options
  65. #Uncomment to fail the build on AppVeyor on any package error
  66. #if ($global:info.error_count.total) { throw 'Errors during update' }