mirror of
https://github.com/kiwix/kiwix-js-pwa.git
synced 2025-09-08 19:57:46 -04:00
End-to-end build and upload for E+N
Former-commit-id: 42692c2a662e58d2a0712ee8923a003f0d4c031b [formerly 67a2d6952861f522e1b8f67290d9f3f7ec9b8497] [formerly f0bd67a70d4a9def26833fc1013e0b2ed94af86b] [formerly 2f9634a2ba7dc799c4415c263270cee2c057c246 [formerly 63c6a7875ec6e94912baaa138f74d07c6246782c [formerly de40db6a6e904aae11dd44597faeb5c6cccfb527]]] Former-commit-id: b96fd1c3b8b13a01416e4fe0b81fd7a779e2823f [formerly f8bba24d3de35b719a01dc58ce1245502b0075f7 [formerly 3d0b0448785bb19189f189d0494c7538defb466e]] Former-commit-id: 0b56494fafcaf403df35b760c5d376626514ac29 [formerly 0f451f527746ec99a1b0ab0d60d3a681916628bf] Former-commit-id: ecdb6a4cf5bda3db0d6b5c12ded639b7c51edfc7
This commit is contained in:
parent
b0c887cbfe
commit
b6c131962f
@ -1,4 +1,10 @@
|
||||
$builds = @("win-x64", "win-ia32", "win-xp")
|
||||
param (
|
||||
[switch]$32bitonly = $false
|
||||
)
|
||||
$builds = @("win-ia32", "win-xp")
|
||||
if (-Not $32bitonly) {
|
||||
$builds += "win-x64"
|
||||
}
|
||||
$version = "0.53.1" # <<< value updated automatically from package.json if launched from Create-DraftRelease
|
||||
$versionXP = "0.14.7"
|
||||
$appBuild = "1.3.0N" # <<< value updated auotmatically from package.json if launched form Create-DraftRelease
|
||||
|
@ -22,7 +22,7 @@ if ($tag_name -eq "") {
|
||||
"Initiating dry run..."
|
||||
}
|
||||
}
|
||||
if (-Not $buildonly) {
|
||||
if (-Not ($buildonly -or $dryrun)) {
|
||||
$buildonly_check = Read-Host "Do you wish to Build only, or build and Release? [B/R]"
|
||||
$buildonly = -Not ( $buildonly_check -imatch 'r' )
|
||||
If ($buildonly) {
|
||||
@ -36,8 +36,9 @@ if ($tag_name -NotMatch '^v\d+\.\d+\.\d+([EN-]|$)') {
|
||||
}
|
||||
"`nCreating release for $tag_name..."
|
||||
$base_tag = $tag_name -replace '^v([\d.EN]+).*', '$1'
|
||||
$text_tag = $tag_name -replace '^v[\d.EN]+-?(.*)$', '$1'
|
||||
$text_tag = $tag_name -replace '^v[\d.EN+]+-?(.*)$', '$1'
|
||||
$numeric_tag = $base_tag -replace "([\d.]+)[EN]", '$1'
|
||||
$old_windows_support = $tag_name -match '\+N'
|
||||
if ($text_tag -eq '') { $text_tag = 'Windows' }
|
||||
$release_title = "Kiwix JS $text_tag $base_tag UWP"
|
||||
if ($text_tag -eq "Wikivoyage") { $release_title = "Wikivoyage by Kiwix $base_tag UWP" }
|
||||
@ -115,6 +116,7 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
if (-Not $buildonly) { "The draft release details were successfully created." }
|
||||
"`nUpdating release version in package.json"
|
||||
$json_object = $json_object -replace '("version": ")[^"]+', "`${1}$base_tag"
|
||||
$json_object = $json_object -replace '\s*$', "`n"
|
||||
if ($dryrun) {
|
||||
"[DRYRUN] would have written:`n"
|
||||
$json_object
|
||||
@ -130,7 +132,7 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
if ($flavour -eq '_E') {
|
||||
$base_dir = "$PSScriptRoot/../bld/electron/"
|
||||
$compressed_archive = $base_dir + "Kiwix.JS.$text_tag.$base_tag.zip"
|
||||
if (-Not (Test-Path $compressed_archive -PathType Leaf)) {
|
||||
if (-Not ($old_windows_support -or (Test-Path $compressed_archive -PathType Leaf))) {
|
||||
# Package portable electron app for Windows
|
||||
"Building portable Electron app for Windows"
|
||||
if (-Not $dryrun) { npm run package-win }
|
||||
@ -203,6 +205,43 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
"Linux Electron package $AppImageArchive is available"
|
||||
}
|
||||
}
|
||||
if ($old_windows_support) {
|
||||
"`nSupport for XP and Vista was requested."
|
||||
"Searching for archives..."
|
||||
$nwjs_base = $PSScriptRoot -ireplace 'kiwix-js-windows.scripts.*$', 'kiwix-js-windows-nwjs'
|
||||
"NWJS base directory: " + $nwjs_base
|
||||
$nwjs_archives_path = "$nwjs_base/bld/nwjs/kiwix_js_windows*$numeric_tag" + "N-win-ia32.zip"
|
||||
"NWJS archives path: " + $nwjs_archives_path
|
||||
$nwjs_archives = dir $nwjs_archives_path
|
||||
if (-Not ($nwjs_archives.count -eq 2)) {
|
||||
"`nBuilding portable 32bit NWJS archives to add to Electron release for XP and Vista..."
|
||||
"Updating Build-NWJS script with required tag..."
|
||||
$script_body = Get-Content -Raw ("$nwjs_base/scripts/Build-NWJS.ps1")
|
||||
$script_body = $script_body -ireplace '(appBuild\s*=\s*")[^"]+', ("`${1}$numeric_tag" + "N")
|
||||
$script_body = $script_body -replace '\s*$', "`n"
|
||||
if ($dryrun) {
|
||||
"[DRYRUN] would have written:`n"
|
||||
$script_body
|
||||
} else {
|
||||
Set-Content "$nwjs_base/scripts/Build-NWJS.ps1" $script_body
|
||||
}
|
||||
if (-Not $dryrun) {
|
||||
"Building..."
|
||||
& $nwjs_base/scripts/Build-NWJS.ps1 -32bitonly
|
||||
} else {
|
||||
"Build command: $nwjs_base/scripts/Build-NWJS.ps1 -32bitonly"
|
||||
}
|
||||
"Verifying build..."
|
||||
$nwjs_archives = dir $nwjs_archives_path
|
||||
if ($nwjs_archives.count -eq 2) {
|
||||
"NWJS packages were correclty built."
|
||||
} else {
|
||||
"Oh no! The NWJS package build failed."
|
||||
}
|
||||
} else {
|
||||
"NWJS packages found."
|
||||
}
|
||||
}
|
||||
$ReleaseBundle = ''
|
||||
} elseif ($flavour -eq '_N') {
|
||||
# Package NWJS app if necessary
|
||||
@ -218,7 +257,7 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
if (-Not $found) { "Unable to locate $NWJSAsset..." }
|
||||
}
|
||||
if (-Not $found) {
|
||||
"WARNING: One or more NWJS build(s) could not be found."
|
||||
"One or more NWJS build(s) could not be found."
|
||||
"`nBuilding..."
|
||||
"Updating Build-NWJS script with required tag..."
|
||||
$script_body = Get-Content -Raw ("$PSScriptRoot/Build-NWJS.ps1")
|
||||
@ -231,6 +270,7 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
"Updating Build-NWJS with NWJS version from package.json: $json_nwVersion"
|
||||
$script_body = $script_body -ireplace '(\$version\s*=\s*")[^"]+', "`${1}$json_nwVersion"
|
||||
}
|
||||
$script_body = $script_body -replace '\s*$', "`n"
|
||||
if ($dryrun) {
|
||||
"[DRYRUN] would have written:`n"
|
||||
$script_body
|
||||
@ -301,7 +341,11 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
$upload_assets = @($compressed_archive, $ReleaseBundle)
|
||||
if ($flavour -eq '_N') { $upload_assets = $NWJSAssets }
|
||||
if ($flavour -eq '_E') {
|
||||
$upload_assets = ($AppImageArchives += $compressed_archive)
|
||||
if ($old_windows_support) {
|
||||
$upload_assets = ($AppImageArchives += $nwjs_archives)
|
||||
} else {
|
||||
$upload_assets = ($AppImageArchives += $compressed_archive)
|
||||
}
|
||||
$upload_assets += $WinInstaller
|
||||
}
|
||||
$upload_uri = $release.upload_url -ireplace '\{[^{}]+}', ''
|
||||
@ -344,15 +388,16 @@ if ($dryrun -or $buildonly -or $release.assets_url -imatch '^https:') {
|
||||
}
|
||||
}
|
||||
}
|
||||
"Creating permalink..."
|
||||
"`nCreating permalink..."
|
||||
$permalinkFile = "$PSScriptRoot/../kiwix-js-uwp.html"
|
||||
if ($tag_name -imatch 'WikiMed') { $permalinkFile = $permalinkFile -replace 'kiwix-js-uwp', 'wikimed-uwp' }
|
||||
if ($tag_name -imatch 'Wikivoyage') { $permalinkFile = $permalinkFile -replace 'kiwix-js-uwp', 'wikivoyage-uwp' }
|
||||
if ($flavour -eq '_N') { $permalinkFile = $permalinkFile -replace 'uwp', 'nwjs' }
|
||||
if ($flavour -eq '_E') { $permalinkFile = $permalinkFile -replace 'uwp', 'electron' }
|
||||
"Looking for: $permalinkFile"
|
||||
$permalink = Get-Content -Raw $permalinkFile
|
||||
$permalink = $permalink -replace 'v[\d.EN]{5,}[^"'']*', $tag_name
|
||||
"Looking for: $permalinkFile"
|
||||
$permalink = $permalink -replace '\s*$', "`n"
|
||||
if (-Not $dryrun) { Set-Content $permalinkFile $permalink }
|
||||
else { "`n[DRYRUN] would have written:`n$permalink`n" }
|
||||
"Cleaning up..."
|
||||
|
Loading…
x
Reference in New Issue
Block a user