mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-11 13:18:21 -04:00
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:
parent
7c806a4a23
commit
b5a4d2579f
@ -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`)
|
# 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
|
# because it modifies variables needed in Create-DraftRelease
|
||||||
$base_dir = "$PSScriptRoot/../bld/electron/"
|
$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 = Read-Host "Do you want to build Electron packages on GitHub? [Y/N]"
|
||||||
$electronbuild_check = -Not ( $electronbuild_check -imatch 'n' )
|
$electronbuild_check = -Not ( $electronbuild_check -imatch 'n' )
|
||||||
@ -39,7 +42,6 @@ if ($electronbuild -eq "cloud") {
|
|||||||
} else {
|
} else {
|
||||||
"[DRYRUN]: Cloudbuild dispatched.`n"
|
"[DRYRUN]: Cloudbuild dispatched.`n"
|
||||||
}
|
}
|
||||||
return
|
|
||||||
}
|
}
|
||||||
# Package installer electron app for Windows
|
# Package installer electron app for Windows
|
||||||
"`nChecking for installer package for Windows..."
|
"`nChecking for installer package for Windows..."
|
||||||
@ -50,19 +52,22 @@ if ($alt_tag -imatch 'WikiMed|Wikivoyage') {
|
|||||||
$comp_electron_archive = $base_dir + "$text_tag.by.Kiwix.$base_tag.zip"
|
$comp_electron_archive = $base_dir + "$text_tag.by.Kiwix.$base_tag.zip"
|
||||||
$WinInstaller = $base_dir + "$alt_tag by Kiwix Setup $numeric_tag-E.exe"
|
$WinInstaller = $base_dir + "$alt_tag by Kiwix Setup $numeric_tag-E.exe"
|
||||||
}
|
}
|
||||||
if (-Not (Test-Path $WinInstaller -PathType Leaf)) {
|
if ($electronbuild -eq "local") {
|
||||||
"No package found: building $WinInstaller..."
|
if (-Not (Test-Path $WinInstaller -PathType Leaf)) {
|
||||||
if (-Not $dryrun) {
|
"No package found: building $WinInstaller..."
|
||||||
npm run dist-win
|
if (-Not $dryrun) {
|
||||||
if (Test-Path $WinInstaller -PathType Leaf) {
|
npm run dist-win
|
||||||
"Successfully built."
|
if (Test-Path $WinInstaller -PathType Leaf) {
|
||||||
} else {
|
"Successfully built."
|
||||||
"Oh no! The Windows installer build failed!"
|
} else {
|
||||||
|
"Oh no! The Windows installer build failed!"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
"Package found."
|
||||||
}
|
}
|
||||||
} 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))) {
|
if (-Not ($old_windows_support -or (Test-Path $comp_electron_archive -PathType Leaf))) {
|
||||||
# Package portable electron app for Windows
|
# Package portable electron app for Windows
|
||||||
"Building portable Electron app for Windows"
|
"Building portable Electron app for Windows"
|
||||||
@ -109,46 +114,48 @@ if (-Not ($old_windows_support -or (Test-Path $comp_electron_archive -PathType L
|
|||||||
"Compressing: $AddAppPackage, $compressed_assets_dir to $comp_electron_archive"
|
"Compressing: $AddAppPackage, $compressed_assets_dir to $comp_electron_archive"
|
||||||
if (-Not $dryrun) { "$AddAppPackage", "$compressed_assets_dir" | Compress-Archive -DestinationPath $comp_electron_archive -Force }
|
if (-Not $dryrun) { "$AddAppPackage", "$compressed_assets_dir" | Compress-Archive -DestinationPath $comp_electron_archive -Force }
|
||||||
}
|
}
|
||||||
# Package Electron app for Linux
|
if ($electronbuild -eq "local") {
|
||||||
"`nChecking for Electron packages for Linux..."
|
# Package Electron app for Linux
|
||||||
$LinuxBasePackage = $base_dir + "Kiwix JS $alt_tag-$numeric_tag-E"
|
"`nChecking for Electron packages for Linux..."
|
||||||
if ($alt_tag -imatch 'Wikivoyage|WikiMed') {
|
$LinuxBasePackage = $base_dir + "Kiwix JS $alt_tag-$numeric_tag-E"
|
||||||
$LinuxBasePackage = $base_dir + "$alt_tag by Kiwix-$numeric_tag-E"
|
if ($alt_tag -imatch 'Wikivoyage|WikiMed') {
|
||||||
}
|
$LinuxBasePackage = $base_dir + "$alt_tag by Kiwix-$numeric_tag-E"
|
||||||
$DebBasePackage = $base_dir + $package_name + "_$numeric_tag-E"
|
}
|
||||||
$RPMBasePackage = $base_dir + $package_name + "-$numeric_tag-E"
|
$DebBasePackage = $base_dir + $package_name + "_$numeric_tag-E"
|
||||||
$AppImageArchives = @("$LinuxBasePackage.AppImage", ($LinuxBasePackage + "-i386.AppImage"),
|
$RPMBasePackage = $base_dir + $package_name + "-$numeric_tag-E"
|
||||||
("$DebBasePackage" + "_i386.deb"), ("$DebBasePackage" + "_amd64.deb"))
|
$AppImageArchives = @("$LinuxBasePackage.AppImage", ($LinuxBasePackage + "-i386.AppImage"),
|
||||||
if ($alt_tag -notmatch 'WikiMed|Wikivoyage') {
|
("$DebBasePackage" + "_i386.deb"), ("$DebBasePackage" + "_amd64.deb"))
|
||||||
$RPMArchives = @("$RPMBasePackage.x86_64.rpm", "$RPMBasePackage.i686.rpm");
|
if ($alt_tag -notmatch 'WikiMed|Wikivoyage') {
|
||||||
$AppImageArchives += $RPMArchives
|
$RPMArchives = @("$RPMBasePackage.x86_64.rpm", "$RPMBasePackage.i686.rpm");
|
||||||
}
|
$AppImageArchives += $RPMArchives
|
||||||
"Processing $AppImageArchives"
|
}
|
||||||
foreach ($AppImageArchive in $AppImageArchives) {
|
"Processing $AppImageArchives"
|
||||||
if (-Not (Test-Path $AppImageArchive -PathType Leaf)) {
|
foreach ($AppImageArchive in $AppImageArchives) {
|
||||||
"No packages found: building $AppImageArchive..."
|
if (-Not (Test-Path $AppImageArchive -PathType Leaf)) {
|
||||||
# To get docker to start, you might need to run below commands as admin
|
"No packages found: building $AppImageArchive..."
|
||||||
# net stop com.docker.service
|
# To get docker to start, you might need to run below commands as admin
|
||||||
# taskkill /IM "Docker Desktop.exe" /F
|
# net stop com.docker.service
|
||||||
# net start com.docker.service
|
# taskkill /IM "Docker Desktop.exe" /F
|
||||||
# runas /noprofile /user:Administrator "net stop com.docker.service; taskkill /IM 'Docker Desktop.exe' /F; net start com.docker.service"
|
# net start com.docker.service
|
||||||
$repo_dir = ($PSScriptRoot -replace '[\\/]scripts[\\/]*$', '')
|
# runas /noprofile /user:Administrator "net stop com.docker.service; taskkill /IM 'Docker Desktop.exe' /F; net start com.docker.service"
|
||||||
# "Using docker command:"
|
$repo_dir = ($PSScriptRoot -replace '[\\/]scripts[\\/]*$', '')
|
||||||
# "docker run -v $repo_dir\:/project -w /project electronuserland/builder npm run dist-linux"
|
# "Using docker command:"
|
||||||
"Using electron-builder in wsl:"
|
# "docker run -v $repo_dir\:/project -w /project electronuserland/builder npm run dist-linux"
|
||||||
"wsl sh -c 'npm run dist-linux'"
|
"Using electron-builder in wsl:"
|
||||||
if (-Not $dryrun) {
|
"wsl sh -c 'npm run dist-linux'"
|
||||||
# docker run -v $repo_dir\:/project -w /project electronuserland/builder npm run dist-linux
|
if (-Not $dryrun) {
|
||||||
cd $repo_dir
|
# docker run -v $repo_dir\:/project -w /project electronuserland/builder npm run dist-linux
|
||||||
rm -r $base_dir/linux-unpacked
|
cd $repo_dir
|
||||||
rm -r $base_dir/linux-ia32-unpacked
|
rm -r $base_dir/linux-unpacked
|
||||||
wsl sh -c "npm run dist-linux"
|
rm -r $base_dir/linux-ia32-unpacked
|
||||||
# Alternatively build with wsl
|
wsl sh -c "npm run dist-linux"
|
||||||
# wsl . ~/.bashrc; npm run dist-linux
|
# Alternatively build with wsl
|
||||||
# docker $build_command
|
# wsl . ~/.bashrc; npm run dist-linux
|
||||||
|
# docker $build_command
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
"Linux Electron package $AppImageArchive is available"
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
"Linux Electron package $AppImageArchive is available"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($old_windows_support) {
|
if ($old_windows_support) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user