@@ -178,8 +178,8 @@ jobs:
178
178
`$ErrorActionPreference = 'Stop'
179
179
`$toolsDir = Split-Path -Parent `$MyInvocation.MyCommand.Definition
180
180
181
- Remove-Item -Path (Join-Path `$toolsDir 'WinMemoryCleaner.exe') -ErrorAction SilentlyContinue
182
- Remove-Item -Path (Join-Path `$toolsDir 'chocolateyinstall.ps1') -ErrorAction SilentlyContinue
181
+ Remove-Item -Path (Join-Path `$toolsDir 'WinMemoryCleaner.exe') -Force - ErrorAction SilentlyContinue
182
+ Remove-Item -Path (Join-Path `$toolsDir 'chocolateyinstall.ps1') -Force - ErrorAction SilentlyContinue
183
183
184
184
`$shortcutPath = Join-Path `$env:ProgramData 'Microsoft\Windows\Start Menu\Programs\WinMemoryCleaner.lnk'
185
185
Remove-ChocolateyShortcut -shortcutFilePath `$shortcutPath
@@ -211,20 +211,24 @@ jobs:
211
211
212
212
- name : Build and Push Chocolatey package
213
213
if : steps.check_chocolatey.outputs.skip == 'false'
214
- shell : pwsh
215
- run : |
216
- cd .\chocolatey-package
217
- choco pack
218
- $nupkgFile = Get-ChildItem -Filter "*.nupkg" | Select-Object -First 1
219
- if (-not $nupkgFile) {
220
- Write-Host "::error::No .nupkg file was created by 'choco pack'."
221
- exit 1
222
- }
223
- choco push $nupkgFile.FullName --source https://push.chocolatey.org/ --api-key "${{ secrets.CHOCOLATEY_API_KEY }}"
224
- if ($LASTEXITCODE -ne 0) {
225
- Write-Host "::error::Failed to push package to Chocolatey."
226
- exit 1
227
- }
214
+ uses : nick-invision/retry@v2
215
+ with :
216
+ timeout_seconds : 300
217
+ max_attempts : 3
218
+ retry_wait_seconds : 60
219
+ command : |
220
+ cd .\chocolatey-package
221
+ choco pack
222
+ $nupkgFile = Get-ChildItem -Filter "*.nupkg" | Select-Object -First 1
223
+ if (-not $nupkgFile) {
224
+ Write-Host "::error::No .nupkg file was created by 'choco pack'."
225
+ exit 1
226
+ }
227
+ choco push $nupkgFile.FullName --source https://push.chocolatey.org/ --api-key "${{ secrets.CHOCOLATEY_API_KEY }}"
228
+ if ($LASTEXITCODE -ne 0) {
229
+ Write-Host "::error::Failed to push package to Chocolatey."
230
+ exit 1
231
+ }
228
232
229
233
- name : Cleanup
230
234
if : always()
0 commit comments