update_all.ps1 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 = '' # Markdown, Text: Custom user message to show
  17. }
  18. }
  19. Gist = @{
  20. Id = $Env:gist_id #Your gist id; leave empty for new private or anonymous gist
  21. ApiKey = $Env:github_api_key #Your github api key - if empty anoymous gist is created
  22. Path = "$PSScriptRoot\Update-AUPackages.md" #List of files to add to the gist
  23. }
  24. Git = @{
  25. User = '' #Git username, leave empty if github api key is used
  26. Password = $Env:github_api_key #Password if username is not empty, otherwise api key
  27. }
  28. RunInfo = @{
  29. Exclude = 'password', 'apikey' #Option keys which contain those words will be removed
  30. Path = "$PSScriptRoot\update_info.xml" #Path where to save the run info
  31. }
  32. Mail = if ($Env:mail_user) {
  33. @{
  34. To = $Env:mail_user
  35. Server = $Env:mail_server
  36. UserName = $Env:mail_user
  37. Password = $Env:mail_pass
  38. Port = $Env:mail_port
  39. EnableSsl = $Env:mail_enablessl -eq 'true'
  40. Attachment = "$PSScriptRoot\update_info.xml"
  41. UserMessage = ''
  42. SendAlways = $false #Send notifications every time
  43. }
  44. } else {}
  45. ForcedPackages = $ForcedPackages -split ' '
  46. BeforeEach = {
  47. param($PackageName, $Options )
  48. $p = $Options.ForcedPackages | ? { $_ -match "^${PackageName}(?:\:(.+))*$" }
  49. if (!$p) { return }
  50. $global:au_Force = $true
  51. $global:au_Version = ($p -split ':')[1]
  52. }
  53. }
  54. if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" }
  55. $global:au_Root = $Root #Path to the AU packages
  56. $global:info = updateall -Name $Name -Options $Options
  57. #Uncomment to fail the build on AppVeyor on any package error
  58. #if ($global:info.error_count.total) { throw 'Errors during update' }