Update the build scripts

This commit is contained in:
ema
2025-05-14 02:18:01 +08:00
parent 97f8232767
commit b28fcbb398
14 changed files with 116 additions and 112 deletions

10
Scripts/pack-7z.ps1 Normal file
View File

@@ -0,0 +1,10 @@
$version = git describe --always --tags --exclude latest
Set-Location ../Build
Write-Output "This file makes QuickLook portable." >> .\Package\portable.lock
Remove-Item .\QuickLook-$version.7z -ErrorAction SilentlyContinue
7z.exe a .\QuickLook-$version.7z .\Package\* -t7z -mx=9 -ms=on -m0=lzma2 -mf=BCJ2 -r -y
Remove-Item .\Package\portable.lock

6
Scripts/pack-all.ps1 Normal file
View File

@@ -0,0 +1,6 @@
# Please build the msi installation package in advance
powershell -file "$(SolutionDir)Scripts\pack-7z.ps1"
powershell -file "$(SolutionDir)Scripts\pack-setup.ps1"
powershell -file "$(SolutionDir)Scripts\pack-appx.ps1"
powershell -file "$(SolutionDir)Scripts\sign-appx.ps1"
Pause

View File

@@ -1,35 +0,0 @@
$version = git describe --always --tags "--abbrev=0" --exclude latest
if($version.Split('.').Length.Equals(3))
{
$version += ".0"
}
function Update-Version($path)
{
$xml = [xml](Get-Content $path)
$xml.Package.Identity.Version="$version"
$xml.Save("$path")
}
if(-not (Test-Path env:CI))
{
# prapare folders
Remove-Item -Recurse ..\Build\Appx -ErrorAction SilentlyContinue
Copy-Item -Recurse ..\Build\Package ..\Build\Appx\Package
Copy-Item -Recurse ..\Build\Assets ..\Build\Appx\Assets
Copy-item ..\Build\AppxManifest.dev.xml ..\Build\Appx\AppxManifest.xml
# set version to git version
Update-Version("..\Build\Appx\AppxManifest.xml")
# generate resources
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makepri.exe'
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
# packing
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\makeappx.exe'
$folder = '..\Build\Appx\'
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx
}

View File

@@ -24,11 +24,11 @@ if(-not (Test-Path env:CI))
Update-Version("..\Build\Appx\AppxManifest.xml")
# generate resources
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makepri.exe'
$priExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\makepri.exe'
.$priExe new /pr ..\Build\Appx /cf ..\Build\priconfig.xml /of ..\Build\Appx\resources.pri
# packing
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x86\makeappx.exe'
$packExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\makeappx.exe'
$folder = '..\Build\Appx\'
.$packExe pack /l /o /d ..\Build\Appx /p ..\Build\QuickLook-$version.appx

View File

@@ -1,16 +1,10 @@
$version = git describe --always --tags --exclude latest
Set-Location ../Build
Remove-Item .\QuickLook.7z -ErrorAction SilentlyContinue
7z a QuickLook.7z .\Package\* -t7z -mx=5 -mf=BCJ2 -r -y
Remove-Item .\Package.7z -ErrorAction SilentlyContinue
7z a Package.7z .\Package\* -t7z -mx=9 -ms=on -m0=lzma2 -mf=BCJ2 -r -y
makemica micasetup.json
Write-Output "This file makes QuickLook portable." >> .\Package\portable.lock
7z a QuickLook.7z .\Package\portable.lock -t7z -mx=5 -mf=BCJ2 -r -y
$version = git describe --always --tags --exclude latest
Remove-Item .\QuickLook-$version.7z -ErrorAction SilentlyContinue
Rename-Item .\QuickLook.7z QuickLook-$version.7z
Remove-Item .\QuickLook-$version.exe -ErrorAction SilentlyContinue
Rename-Item .\QuickLook.exe QuickLook-$version.exe
pause
Remove-Item .\Package.7z -ErrorAction SilentlyContinue

View File

@@ -1,5 +1,22 @@
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.17763.0\x86\signtool.exe'
$files = gci '..\Build\QuickLook-*.appx' | %{('"{0}"' -f $_.FullName)}
$opensslExe = 'C:\Program Files\Git\usr\bin\openssl.exe'
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.26100.0\x86\signtool.exe'
$timestampUrl = 'http://time.certum.pl/'
$version = git describe --always --tags "--abbrev=0" --exclude latest
.$signExe sign /a /v /fd sha256 /t $timestampUrl $files
if($version.Split('.').Length.Equals(3))
{
$version += ".0"
}
Set-Location ../Build
if (-not (Test-Path sideload.key)) {
.$opensslExe genrsa -out "sideload.key" 2048
}
if (-not (Test-Path sideload.pfx)) {
.$opensslExe req -new -x509 -days 825 -key "sideload.key" -out "sideload.crt" -config "openssl-sign.cnf" -subj "/CN=CE36AF3D-FF94-43EB-9908-7EC8FD1D29FB"
.$opensslExe pkcs12 -export -out "sideload.pfx" -inkey "sideload.key" -in "sideload.crt" -password pass:123456
}
.$signExe sign /fd sha256 /f "sideload.pfx" /p 123456 /td sha256 /tr $timestampUrl QuickLook-$version.appx
.$signExe verify /pa /v QuickLook-$version.appx