From b413fa3ac01c2f4eb5e1024a3f1a8e05fdb09d34 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 13 Jun 2021 21:53:40 +0100 Subject: [PATCH] Add automation to update winget repository Former-commit-id: bccf1942c990f55b920a7bb9ded8c147a890c3da [formerly 0fb4cd972efdfab724eae15471955ea07d3f5849 [formerly 43cbcc66289f4b339afe1b7eebb248dc527b702b]] Former-commit-id: d21419453042505ecf9f19995dc7dd2f27c77b39 Former-commit-id: 17f88320eb32d928a7161eda2fa61ca61ddc44b3 --- scripts/Create-DraftRelease.ps1 | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/scripts/Create-DraftRelease.ps1 b/scripts/Create-DraftRelease.ps1 index 6ec3dadf..8b363dcb 100644 --- a/scripts/Create-DraftRelease.ps1 +++ b/scripts/Create-DraftRelease.ps1 @@ -4,7 +4,8 @@ param ( [switch]$usestorerelease = $false, [switch]$draftonly = $false, [switch]$buildonly = $false, - [switch]$updatewinget = $false + [switch]$updatewinget = $false, + [string]$respondtowingetprompt = "" # Provide an override response (Y/N) to the winget prompt at the end of the script - for automation ) # DEV: To build Electron packages for all platforms and NWJS for XP and Vista in a single release, use, e.g., "v1.3.0E+N" (Electron + NWJS) # DEV: To build new icons, use @@ -487,7 +488,28 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') { else { "`n[DRYRUN] would have written:`n$permalink`n" } "Cleaning up..." if ((-Not ($dryrun -or $old_windows_support)) -and $compressed_archive ) { del $compressed_archive } - "`nDone." + "`nDone.`n" + # Now update winget manifest if we are not building NWJS or Electron + if ($flavour -eq '') { + if ($respondtowingetprompt) { + $wingetcreate_check = $respondtowingetprompt + } else { + $wingetcreate_check = Read-Host "Would you like to update the WinGet repository with this new build? [Y/N]" + } + $wingetcreate_check = -Not ( $wingetcreate_check -imatch 'n' ) + if ($wingetcreate_check) { + "`nUpdating WinGet repository..." + cd $PSScriptRoot\.. + pwd + if (-Not $dryrun) { + & .\scripts\Create-DraftRelease.ps1 -updatewinget -tag_name $tag_name + } else { + "[DRYRUN:] & .\scripts\Create-DraftRelease.ps1 -updatewinget -tag_name $tag_name" + } + } else { + "You can update the WinGet repository manually by running 'Create-DraftRelease -updatewinget'" + } + } } else { "There was an error setting up the release!" if ($release) {