Update Build-Electron.ps1

Former-commit-id: 893561a454a81e29b75f17c69bc3ccc17c513f4a [formerly 782aa0ebfedf2c6bab720f438789100929431038] [formerly 054eddb22685b1941d8119f47de2137705d20dfa] [formerly df6c901dbbc16f39daca1a7474b01d3f7f6dfa0a [formerly 305fb2b384498f98225faeff9746188189ac00c2 [formerly 1ebc0451f2bc8e02d4a62c0bb5a863485ff9227d]]]
Former-commit-id: 7cac061a80d4c8495405aa101fd003f54a855cb2 [formerly de5e7029f4938798da39ed2e9dcc5ab35d833214 [formerly 3b6e62a62a784efffc6814cfcb53c1447b592500]]
Former-commit-id: 7a938eff38dd3086b5d4d8a669fe773bafdb48b4 [formerly dbeb4601de821d2ec230b31f19398f26fd0bea53]
Former-commit-id: 6de6eeecd7980a46700446039dfedc08a153b477
This commit is contained in:
Jaifroid 2022-03-05 19:09:05 +00:00
parent 7c806a4a23
commit b5a4d2579f

View File

@ -1,7 +1,10 @@
# This script is intended to be run by Create-DraftRelease, and must be dot-sourced (run with `. ./Build-Electron.ps1` or `. /path/to/Build-Electron.ps1`)
# because it modifies variables needed in Create-DraftRelease
$base_dir = "$PSScriptRoot/../bld/electron/"
if ($electronbuild -eq "") {
if ($text_tag -match 'WikiMed|Wikivoyage') {
$electronbuild = "local"
}
if (($electronbuild -eq "")) {
""
$electronbuild_check = Read-Host "Do you want to build Electron packages on GitHub? [Y/N]"
$electronbuild_check = -Not ( $electronbuild_check -imatch 'n' )
@ -39,7 +42,6 @@ if ($electronbuild -eq "cloud") {
} else {
"[DRYRUN]: Cloudbuild dispatched.`n"
}
return
}
# Package installer electron app for Windows
"`nChecking for installer package for Windows..."
@ -50,6 +52,7 @@ if ($alt_tag -imatch 'WikiMed|Wikivoyage') {
$comp_electron_archive = $base_dir + "$text_tag.by.Kiwix.$base_tag.zip"
$WinInstaller = $base_dir + "$alt_tag by Kiwix Setup $numeric_tag-E.exe"
}
if ($electronbuild -eq "local") {
if (-Not (Test-Path $WinInstaller -PathType Leaf)) {
"No package found: building $WinInstaller..."
if (-Not $dryrun) {
@ -63,6 +66,8 @@ if (-Not (Test-Path $WinInstaller -PathType Leaf)) {
} else {
"Package found."
}
}
# Portable app isn't built in the cloud, so we always run this
if (-Not ($old_windows_support -or (Test-Path $comp_electron_archive -PathType Leaf))) {
# Package portable electron app for Windows
"Building portable Electron app for Windows"
@ -109,6 +114,7 @@ if (-Not ($old_windows_support -or (Test-Path $comp_electron_archive -PathType L
"Compressing: $AddAppPackage, $compressed_assets_dir to $comp_electron_archive"
if (-Not $dryrun) { "$AddAppPackage", "$compressed_assets_dir" | Compress-Archive -DestinationPath $comp_electron_archive -Force }
}
if ($electronbuild -eq "local") {
# Package Electron app for Linux
"`nChecking for Electron packages for Linux..."
$LinuxBasePackage = $base_dir + "Kiwix JS $alt_tag-$numeric_tag-E"
@ -151,6 +157,7 @@ foreach ($AppImageArchive in $AppImageArchives) {
"Linux Electron package $AppImageArchive is available"
}
}
}
if ($old_windows_support) {
"`nSupport for XP and Vista was requested."
"Searching for archives..."