From 1093e09aaee108d4f19b8ebd9781622683b61cf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20D=C3=A9moulins?= Date: Fri, 23 Jun 2023 19:46:37 +0200 Subject: [PATCH] Better CI --- .github/workflows/.common.yml | 64 ++++++-------- .github/workflows/airserver.yml | 2 +- .github/workflows/eclipse.yml | 2 +- .github/workflows/hashcheck.yml | 2 +- .github/workflows/ilspy.yml | 2 +- .github/workflows/imdisk.yml | 2 +- .github/workflows/kodi.yml | 2 +- .github/workflows/lavfilters.yml | 2 +- .github/workflows/marble.yml | 2 +- .github/workflows/procexp.yml | 3 +- .github/workflows/procmon.yml | 2 +- .github/workflows/sabnzbd.yml | 2 +- .github/workflows/serviio.yml | 2 +- .github/workflows/stellarium.yml | 2 +- .github/workflows/strawberryperl.yml | 2 +- .github/workflows/subtitleedit.yml | 2 +- .github/workflows/vscodium.yml | 2 +- LICENSE.md | 2 +- README.md | 1 - test_all.ps1 | 125 --------------------------- update_all.ps1 | 95 +++++--------------- update_vars_default.ps1 | 7 -- 22 files changed, 65 insertions(+), 262 deletions(-) delete mode 100644 test_all.ps1 delete mode 100644 update_vars_default.ps1 diff --git a/.github/workflows/.common.yml b/.github/workflows/.common.yml index b6829b5f..59f4c483 100644 --- a/.github/workflows/.common.yml +++ b/.github/workflows/.common.yml @@ -16,6 +16,7 @@ jobs: update: name: Update ${{ github.workflow }} runs-on: windows-latest + # runs-on: ubuntu-latest timeout-minutes: 20 env: @@ -23,39 +24,36 @@ jobs: au_version: release steps: - - name: Set up git - if: ${{ !inputs.test }} - run: | - git config --global user.name "GitHub Actions Bot" - git config --global user.email "<>" - git config --global core.safecrlf false + # - name: Set up git + # if: ${{ !inputs.test }} + # run: | + # git config --global user.name "GitHub Actions Bot" + # git config --global user.email "<>" + # git config --global core.safecrlf false - name: Checkout uses: actions/checkout@v3 - name: Install AU + # shell: pwsh run: | git clone -q https://github.com/Thilas/au.git $Env:TEMP/au . "$Env:TEMP/au/scripts/Install-AU.ps1" $Env:au_version - - name: Install chocolatey-core.extension # required for several packages - run: choco install -y --no-progress chocolatey-core.extension + # - name: Install chocolatey-core.extension # required for several packages + # run: choco install -y --no-progress chocolatey-core.extension - name: Update packages id: updates + # shell: pwsh run: | $arguments = @{ Name = $Env:packages -replace ' ','' -split ',' } - if ($Env:test -ne 'true' -and $Env:force -eq 'true') { + if ($Env:force -eq 'true') { $arguments.Force = $true } - $script = if ($Env:test -eq 'true') { - './test_all.ps1' - } else { - './update_all.ps1' - } - [array] $packages = & $script @arguments -ThrowOnErrors -PassThru -UpdatesOnly | ForEach-Object { + [array] $packages = ./update_all.ps1 @arguments | ForEach-Object { $_ | ConvertTo-Json -Compress } $packages = ConvertTo-Json $packages -Compress @@ -63,24 +61,14 @@ jobs: "packages=$packages" >> $Env:GITHUB_OUTPUT env: packages: ${{ inputs.packages }} - test: ${{ inputs.test }} - force: ${{ inputs.force }} + force: ${{ inputs.test || inputs.force }} github_user_repo: ${{ github.repository }} - github_api_key: ${{ secrets.GITHUB_TOKEN }} - au_push: ${{ !inputs.test }} - api_key: ${{ secrets.CHOCOLATEY_KEY }} + # api_key: ${{ secrets.CHOCOLATEY_KEY }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Publish report - if: always() && hashFiles('Update-AUPackages.md', 'Update-Force-Test*.md') - run: Get-Content 'Update-AUPackages.md', 'Update-Force-Test*.md' -ErrorAction SilentlyContinue >> $Env:GITHUB_STEP_SUMMARY - - - name: Upload Info artifact - if: always() && hashFiles('update_info.xml') - uses: actions/upload-artifact@v3.1.2 - with: - name: Info - path: update_info.xml + if: always() && hashFiles('report.md') + run: Get-Content 'report.md' -ErrorAction SilentlyContinue >> $Env:GITHUB_STEP_SUMMARY - name: Prepare Packages artifact if: always() && hashFiles('**/*.nupkg') @@ -90,7 +78,7 @@ jobs: - name: Upload Packages artifact if: always() && hashFiles('Packages/*.nupkg') - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@v3 with: name: Packages path: Packages/*.nupkg @@ -98,7 +86,7 @@ jobs: outputs: updates: ${{ steps.updates.outputs.packages }} - packages: + test: if: needs.update.outputs.updates != 'null' needs: update @@ -119,20 +107,20 @@ jobs: PackageVersion: ${{ fromJSON(matrix.package).version }} steps: - - name: Remove package if installed + - name: Remove package if needed run: | - if (choco list -r --local `"$Env:PackageName`") { + if (choco list -r `"$Env:PackageName`") { choco uninstall -y --no-progress `"$Env:PackageName`" } - name: Download Packages artifact - uses: actions/download-artifact@v3.0.2 + uses: actions/download-artifact@v3 with: name: Packages - name: Install package run: | - choco install -y --no-progress `"$Env:PackageName`" --version `"$Env:PackageVersion`" --source `"'.;https://community.chocolatey.org/api/v2/'`" --force --debug + choco install -y --no-progress `"$Env:PackageName`" --version `"$Env:PackageVersion`" --source `"'.;https://community.chocolatey.org/api/v2/'`" --force --verbose --debug if ($LASTEXITCODE -in 1641, 3010) { exit 0 } timeout-minutes: 10 @@ -145,7 +133,7 @@ jobs: "path=$path" >> $Env:GITHUB_OUTPUT - name: Upload Information artifact - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@v3 with: name: Information ${{ env.PackageName }} ${{ env.PackageVersion }} on ${{ matrix.os }} path: ${{ steps.information.outputs.path }} @@ -154,7 +142,7 @@ jobs: # AirServer requires Wireless-Networking while uninstalling, feature not installed on GitHub agents if: env.PackageName != 'airserver' run: | - choco uninstall -y --no-progress `"$Env:PackageName`" --debug + choco uninstall -y --no-progress `"$Env:PackageName`" --verbose --debug if ($LASTEXITCODE -in 1605, 1614, 1641, 3010) { exit 0 } timeout-minutes: 10 @@ -166,7 +154,7 @@ jobs: - name: Upload failure screenshot into Information artifact if: failure() - uses: actions/upload-artifact@v3.1.2 + uses: actions/upload-artifact@v3 with: name: Information ${{ env.PackageName }} ${{ env.PackageVersion }} on ${{ matrix.os }} path: desktop.png diff --git a/.github/workflows/airserver.yml b/.github/workflows/airserver.yml index 8a252636..db253b92 100644 --- a/.github/workflows/airserver.yml +++ b/.github/workflows/airserver.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/airserver.yml - airserver/** - Common.ps1 diff --git a/.github/workflows/eclipse.yml b/.github/workflows/eclipse.yml index 18daae58..7f60385a 100644 --- a/.github/workflows/eclipse.yml +++ b/.github/workflows/eclipse.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/eclipse.yml - eclipse/** - Common.ps1 diff --git a/.github/workflows/hashcheck.yml b/.github/workflows/hashcheck.yml index c6b53f72..260b5b9b 100644 --- a/.github/workflows/hashcheck.yml +++ b/.github/workflows/hashcheck.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/hashcheck.yml - hashcheck/** - Common.ps1 diff --git a/.github/workflows/ilspy.yml b/.github/workflows/ilspy.yml index dea665a0..8e985caf 100644 --- a/.github/workflows/ilspy.yml +++ b/.github/workflows/ilspy.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/ilspy.yml - ilspy/** - Common.ps1 diff --git a/.github/workflows/imdisk.yml b/.github/workflows/imdisk.yml index 5db068cb..b22b9953 100644 --- a/.github/workflows/imdisk.yml +++ b/.github/workflows/imdisk.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/imdisk.yml - imdisk/** - Common.ps1 diff --git a/.github/workflows/kodi.yml b/.github/workflows/kodi.yml index 43355e96..e58b7a47 100644 --- a/.github/workflows/kodi.yml +++ b/.github/workflows/kodi.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/kodi.yml - kodi/** - Common.ps1 diff --git a/.github/workflows/lavfilters.yml b/.github/workflows/lavfilters.yml index 608fedb0..b7bb3e49 100644 --- a/.github/workflows/lavfilters.yml +++ b/.github/workflows/lavfilters.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/lavfilters.yml - lavfilters/** - Common.ps1 diff --git a/.github/workflows/marble.yml b/.github/workflows/marble.yml index 27536f88..ba3521e1 100644 --- a/.github/workflows/marble.yml +++ b/.github/workflows/marble.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/marble.yml - marble/** - Common.ps1 diff --git a/.github/workflows/procexp.yml b/.github/workflows/procexp.yml index ada4ed78..0a29e540 100644 --- a/.github/workflows/procexp.yml +++ b/.github/workflows/procexp.yml @@ -9,8 +9,7 @@ on: - .github/workflows/procexp.yml - procexp/** - Common.ps1 - - test_all.ps1 - - update_vars.ps1 + - update_all.ps1 schedule: - cron: 0 4 * * * # Scheduled test - cron: 25 1-23/6 * * * # Scheduled update diff --git a/.github/workflows/procmon.yml b/.github/workflows/procmon.yml index c4dfcac6..74a25447 100644 --- a/.github/workflows/procmon.yml +++ b/.github/workflows/procmon.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/procmon.yml - procmon/** - Common.ps1 diff --git a/.github/workflows/sabnzbd.yml b/.github/workflows/sabnzbd.yml index 03441a4c..7a3c408d 100644 --- a/.github/workflows/sabnzbd.yml +++ b/.github/workflows/sabnzbd.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/sabnzbd.yml - sabnzbd/** - Common.ps1 diff --git a/.github/workflows/serviio.yml b/.github/workflows/serviio.yml index f72cdd7d..efbccc2f 100644 --- a/.github/workflows/serviio.yml +++ b/.github/workflows/serviio.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/serviio.yml - serviio/** - Common.ps1 diff --git a/.github/workflows/stellarium.yml b/.github/workflows/stellarium.yml index 767f868e..fb25364d 100644 --- a/.github/workflows/stellarium.yml +++ b/.github/workflows/stellarium.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/stellarium.yml - stellarium/** - Common.ps1 diff --git a/.github/workflows/strawberryperl.yml b/.github/workflows/strawberryperl.yml index 004cdacc..8a5bf858 100644 --- a/.github/workflows/strawberryperl.yml +++ b/.github/workflows/strawberryperl.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/strawberryperl.yml - strawberryperl/** - Common.ps1 diff --git a/.github/workflows/subtitleedit.yml b/.github/workflows/subtitleedit.yml index 946781a2..a82ac9db 100644 --- a/.github/workflows/subtitleedit.yml +++ b/.github/workflows/subtitleedit.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/subtitleedit.yml - subtitleedit/** - Common.ps1 diff --git a/.github/workflows/vscodium.yml b/.github/workflows/vscodium.yml index d33b48bc..047f733c 100644 --- a/.github/workflows/vscodium.yml +++ b/.github/workflows/vscodium.yml @@ -5,7 +5,7 @@ on: types: [opened, reopened, synchronize] branches: [master] paths: - - .github/workflows/.common.yml + # - .github/workflows/.common.yml - .github/workflows/vscodium.yml - vscodium/** - vscodium.*/** diff --git a/LICENSE.md b/LICENSE.md index a66f94e9..a2cc60df 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2017 Thomas Démoulins, Miodrag Milić +Copyright (c) 2023 Thomas Démoulins, Miodrag Milić Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index ea632533..b48fe9a7 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ The following global variables influence the execution of `update_all.ps1` scrip ```powershell $au_NoPlugins = $true #Do not execute plugins -$au_Push = $false #Do not push to chocolatey ``` You can also call AU method `Update-AUPackages` (alias `updateall`) on its own in the repository root. This will just run the updater for the each package without any other option from `update_all.ps1` script. For example to force update of all packages with a single command execute: diff --git a/test_all.ps1 b/test_all.ps1 deleted file mode 100644 index a73382c1..00000000 --- a/test_all.ps1 +++ /dev/null @@ -1,125 +0,0 @@ -param( - [string[]] $Name, # Name can be 'random N' to randomly force the Nth group of packages - [string] $Root = $PSScriptRoot, # Path to the AU packages - [switch] $ThrowOnErrors, - [switch] $PassThru, - [switch] $UpdatesOnly -) - -if (Test-Path "$PSScriptRoot/update_vars.ps1") { . "$PSScriptRoot/update_vars.ps1" | Out-Null } -$global:au_Root = Resolve-Path $Root - -if ($Name.Length -eq 1 -and $Name[0] -match '^random (.+)') { - [array] $packages = Get-AuPackages - - $group = [int] $Matches[1] - $n = Get-Random -Maximum $group - Write-Host "TESTING GROUP $($n+1) of $group" - - $group_size = [int] ($packages.Count / $group) + 1 - $Name = $packages | Select-Object -First $group_size -Skip ($group_size * $n) | ForEach-Object Name - - Write-Host ($Name -join ' ') - Write-Host ('-'*80) -} - -$report_path = if ($null -eq $n) { - "$PSScriptRoot\Update-Force-Test.md" -} else { - "$PSScriptRoot\Update-Force-Test-$n.md" -} - -$options = [ordered] @{ - Force = $true # Force all packages - Timeout = 120 # Connection timeout in seconds - UpdateTimeout = 300 # Update timeout in seconds - Threads = 10 # Number of background jobs to use - Push = $false # Push to chocolatey - - IgnoreOn = @( # Error message parts to set the package ignore status - 'Could not create SSL/TLS secure channel' - 'Could not establish trust relationship' - 'The operation has timed out' - 'Internal Server Error' - 'Service Temporarily Unavailable' - 'The connection was closed unexpectedly' - 'package version already exists' - 'already exists on a Simple OData Server' # https://github.com/chocolatey/chocolatey.org/issues/613 - 'Conflict' - 'A system shutdown has already been scheduled' # https://gist.github.com/choco-bot/a14b1e5bfaf70839b338eb1ab7f8226f#wps-office-free - 'Choco pack failed with exit code 1' - "The term 'Write-FunctionCallLogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The term 'Install-ChocolateyPackage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The property 'MaxIdleTime' cannot be found on this object. Verify that the property exists and can be set" - ) - RepeatOn = @( # Error message parts on which to repeat package updater - 'Could not create SSL/TLS secure channel' # https://github.com/chocolatey/chocolatey-coreteampackages/issues/718 - 'Could not establish trust relationship' # -||- - 'Unable to connect' - 'The remote name could not be resolved' - 'Choco pack failed with exit code 1' # https://github.com/chocolatey/chocolatey-coreteampackages/issues/721 - 'The operation has timed out' - 'Internal Server Error' - 'An exception occurred during a WebClient request' - 'remote session failed with an unexpected state' - 'The connection was closed unexpectedly' - "Can't validate URL" - 'Oops, something went wrong' - 'Job returned no object, Vector smash ?' - "The term 'Write-FunctionCallLogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The term 'Install-ChocolateyPackage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The property 'MaxIdleTime' cannot be found on this object. Verify that the property exists and can be set" - 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond' - 'The SSL connection could not be established' - ) - RepeatSleep = 30 # How much to sleep between repeats in seconds, by default 0 - RepeatCount = 5 # How many times to repeat on errors, by default 1 - - Report = @{ - Type = 'markdown' # Report type: markdown or text - Path = $report_path # Path where to save the report - Params = @{ # Report parameters: - Github_UserRepo = $Env:github_user_repo # Markdown: shows user info in upper right corner - NoAppVeyor = $true # Markdown: do not show AppVeyor build shield - Title = 'Update Force Test' # Markdown, Text: Title of the report, by default 'Update-AUPackages' - UserMessage = @( # Markdown, Text: Custom user message to show - "[Ignored](#ignored)" - "[Build](https://github.com/$Env:github_user_repo/actions)" - "[Releases](https://github.com/$Env:github_user_repo/tags)" - "**USING AU NEXT VERSION**" - ) -join " | " - NoIcons = $false # Markdown: don't show icon - IconSize = 32 # Markdown: icon size - } - } -} - -# Enable TLS1.2 -[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" - -$info = Update-AuPackages -Name $Name -Options $options - -if ($ThrowOnErrors -and ($info | Where-Object Error)) { - Write-Error 'Errors during test' -} - -if ($PassThru) { - if ($UpdatesOnly) { - $updates = $info | Where-Object Updated | ForEach-Object { - if ($_.Streams) { - $_.Streams.Values | Where-Object Updated | ForEach-Object { [pscustomobject] @{ - name = $_.Name - version = $_.RemoteVersion - } } - } else { - $_ | ForEach-Object { [pscustomobject] @{ - name = $_.Name - version = $_.RemoteVersion - } } - } - } - return $updates - } else { - return $info - } -} diff --git a/update_all.ps1 b/update_all.ps1 index 3657bccc..0c1064fe 100644 --- a/update_all.ps1 +++ b/update_all.ps1 @@ -1,29 +1,19 @@ -# AU Packages Template: https://github.com/majkinetor/au-packages-template -param( +param( [string[]] $Name, [switch] $Force, - [string] $ForcedPackages, - [string] $Root = $PSScriptRoot, # Path to the AU packages - [switch] $ThrowOnErrors, - [switch] $PassThru, - [switch] $UpdatesOnly + [switch] $WhatIf, + [string] $Root = $PSScriptRoot # Path to the AU packages ) -if (Test-Path "$PSScriptRoot/update_vars.ps1") { . "$PSScriptRoot/update_vars.ps1" | Out-Null } $global:au_Root = Resolve-Path $Root -$report_path = "$PSScriptRoot\Update-AUPackages.md" -$update_info = "$PSScriptRoot\update_info.xml" - $options = [ordered] @{ - WhatIf = $au_WhatIf # Whatif all packages + WhatIf = $WhatIf # Whatif all packages Force = $Force # Force all packages Timeout = 120 # Connection timeout in seconds UpdateTimeout = 300 # Update timeout in seconds Threads = 10 # Number of background jobs to use - Push = $Env:au_Push -eq 'true' # Push to chocolatey - PushAll = $true # Allow to push multiple packages at once - # PluginPath = '' # Path to user plugins + Push = $false # Push to chocolatey IgnoreOn = @( # Error message parts to set the package ignore status 'Could not create SSL/TLS secure channel' @@ -36,8 +26,6 @@ $options = [ordered] @{ 'already exists on a Simple OData Server' # https://github.com/chocolatey/chocolatey.org/issues/613 'Conflict' 'A system shutdown has already been scheduled' # https://gist.github.com/choco-bot/a14b1e5bfaf70839b338eb1ab7f8226f#wps-office-free - "The term 'Write-FunctionCallLogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The term 'Install-ChocolateyPackage' is not recognized as a name of a cmdlet, function, script file, or executable program" "The property 'MaxIdleTime' cannot be found on this object. Verify that the property exists and can be set" ) RepeatOn = @( # Error message parts on which to repeat package updater @@ -53,9 +41,7 @@ $options = [ordered] @{ "Can't validate URL" 'Oops, something went wrong' 'The connection was closed unexpectedly' - "The term 'Write-FunctionCallLogMessage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The term 'Install-ChocolateyPackage' is not recognized as a name of a cmdlet, function, script file, or executable program" - "The property 'MaxIdleTime' cannot be found on this object. Verify that the property exists and can be set" + 'Job returned no object, Vector smash ?' 'A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond' 'The SSL connection could not be established' ) @@ -64,78 +50,41 @@ $options = [ordered] @{ Report = @{ Type = 'markdown' # Report type: markdown or text - Path = $report_path # Path where to save the report + Path = "$PSScriptRoot\report.md" # Path where to save the report Params = @{ # Report parameters: Github_UserRepo = $Env:github_user_repo # Markdown: shows user info in upper right corner NoAppVeyor = $true # Markdown: do not show AppVeyor build shield - Title = '' # Markdown, Text: Title of the report, by default 'Update-AUPackages' + Title = 'AU Report' # Markdown, Text: Title of the report, by default 'Update-AUPackages' UserMessage = @( # Markdown, Text: Custom user message to show - "[Ignored](#ignored)" "[Build](https://github.com/$Env:github_user_repo/actions)" - "[Releases](https://github.com/$Env:github_user_repo/tags)" - "**TESTING AU NEXT VERSION**" + "[Releases](https://github.com/$Env:github_user_repo/releases)" ) -join " | " NoIcons = $false # Markdown: don't show icon IconSize = 32 # Markdown: icon size } } - - Git = @{ - User = '' # Git username, leave empty if github api key is used - Password = $Env:github_api_key # Password if username is not empty, otherwise api key - } - - GitReleases = @{ - ApiToken = $Env:github_api_key # Your github api key - ReleaseType = 'package' # Either 1 release per date, or 1 release per package - } - - RunInfo = @{ - Exclude = 'password', 'apikey', 'apitoken' # Option keys which contain those words will be removed - Path = $update_info # Path where to save the run info - } - - ForcedPackages = $ForcedPackages -split ' ' - BeforeEach = { - param($PackageName, $Options) - - $pattern = "^${PackageName}(?:\\(?[^:]+))?(?:\:(?.+))?$" - $p = $Options.ForcedPackages | Where-Object { $_ -match $pattern } - if (!$p) { return } - - $global:au_Force = $true - $global:au_IncludeStream = $Matches['stream'] - $global:au_Version = $Matches['version'] - } } # Enable TLS1.2 [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor "Tls12" -if ($ForcedPackages) { Write-Host "FORCED PACKAGES: $ForcedPackages" } $info = Update-AuPackages -Name $Name -Options $options -if ($ThrowOnErrors -and ($info | Where-Object Error)) { - Write-Error 'Errors during update' +if ($info | Where-Object Error) { + Write-Error 'Errors during updates' } -if ($PassThru) { - if ($UpdatesOnly) { - $updates = $info | Where-Object Updated | ForEach-Object { - if ($_.Streams) { - $_.Streams.Values | Where-Object Updated | ForEach-Object { [pscustomobject] @{ - name = $_.Name - version = $_.RemoteVersion - } } - } else { - $_ | ForEach-Object { [pscustomobject] @{ - name = $_.Name - version = $_.RemoteVersion - } } - } - } - return $updates +$updates = $info | Where-Object Updated | ForEach-Object { + if ($_.Streams) { + $_.Streams.Values | Where-Object Updated | ForEach-Object { [pscustomobject] @{ + name = $_.Name + version = $_.RemoteVersion + } } } else { - return $info + $_ | ForEach-Object { [pscustomobject] @{ + name = $_.Name + version = $_.RemoteVersion + } } } } +return $updates diff --git a/update_vars_default.ps1 b/update_vars_default.ps1 deleted file mode 100644 index 3eaa0132..00000000 --- a/update_vars_default.ps1 +++ /dev/null @@ -1,7 +0,0 @@ -# AU Packages Template: https://github.com/majkinetor/au-packages-template -# Copy this file to update_vars.ps1 and set the variables there. Do not include it in the repository. - -$Env:api_key = '' # Chocolatey api key -$Env:github_user_repo = '' # {github_user}/{repo} -$Env:github_api_key = '' # Github personal access token -$Env:au_Push = 'false' # Push to chocolatey