From 2e22c063b624b8bdc9fb09c205ddf331554952b4 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Sun, 30 May 2021 09:50:58 +0100 Subject: [PATCH] Update scripts to build UWP app Former-commit-id: 5596142e645370e541ebbf5646f202036e639484 [formerly 428d22fbea0195d4321c561336ba1e07c6e634ac] [formerly 19037ea17c15a19e31828a018b5dfb1d4d97a401] [formerly 5dbf19c0dc663505b01720cf077430ce18be46af [formerly 7309c98b9ef7d5d6553b2b14b48abd0050036f9c [formerly c1cd6d4ce23129e08fb154fe8451644c2e0a9d51]]] Former-commit-id: 99787d54ddd10e96ef35b76e04bd2e1b772de4f4 [formerly eeaf3fd2f248d889f63bdb6e399072314870f258 [formerly 492f45f77bc2256949a55383492a5ef655d518bc]] Former-commit-id: 8a0071708e605c93157035cd04ba55039f72ff63 [formerly 4a7030a9458e26e0bcc6b3feeebe6355da1dd504] Former-commit-id: 144b1664b40d37974abf9f8e07667d0cf9c3f9cb --- scripts/Build-UWP.bat | 1 + scripts/Create-DraftRelease.ps1 | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 scripts/Build-UWP.bat diff --git a/scripts/Build-UWP.bat b/scripts/Build-UWP.bat new file mode 100644 index 00000000..3cb89c22 --- /dev/null +++ b/scripts/Build-UWP.bat @@ -0,0 +1 @@ +cmd.exe /c " "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" && msbuild.exe -p:Configuration=Release " diff --git a/scripts/Create-DraftRelease.ps1 b/scripts/Create-DraftRelease.ps1 index 96c006a7..8cfe8029 100644 --- a/scripts/Create-DraftRelease.ps1 +++ b/scripts/Create-DraftRelease.ps1 @@ -285,6 +285,30 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') { } } } else { + # We need assets for the MS Store - check the release has been built + $ReleaseBundle = dir "$PSScriptRoot/../AppPackages/*_$base_tag*_Test/*_$base_tag*.appx*" + # Check the file exists and it's of the right type + if ($ReleaseBundle -and ($ReleaseBundle.count -eq 1) -and (Test-Path $ReleaseBundle -PathType leaf) -and + ($ReleaseBundle -imatch '\.(?:appx|appxbundle|appxupload)$')) { + "`nUWP app packages were found." + } else { + "`nBuilding UWP app..." + $appxmanifest = Get-Content -Raw $PSScriptRoot/../package.appxmanifest + if (-Not ($appxmanifest -match "Version=['`"]$numeric_tag\.0['`"]")) { + "The requested release version does not match the version in package.appxmanifest" + "Updating..." + $appxmanifest = $appxmanifest -replace "(Version=['`"])\d+\.\d+\.\d+(\.0['`"])", "`${1}$numeric_tag`${2}" + if (-Not $dryrun) { + Set-Content $PSScriptRoot/../package.appxmanifest $appxmanifest + } else { + "[DRYRUN] Would have written package.appxmanifest:" + "$appxmanifest" + } + } + if (-Not $dryrun) { + cmd.exe /c " `"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat`" && msbuild.exe -p:Configuration=Release" + } + } # If we are releasing the MS Store version we have to copy it from a different location if ($usestorerelease) { "Using Store release becuase usestorerelease flag was set." @@ -314,7 +338,7 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') { return } else { "No package matching that tag was found. Aborting." - "Tag yielded $ReleaseBundle" + "Tag yielded: $ReleaseBundle" return } # ZIP the remaining assets