FluentUI/scripts/windows-publish.ps1

52 lines
1.8 KiB
PowerShell
Raw Permalink Normal View History

2023-03-07 23:41:44 +08:00
[CmdletBinding()]
param (
[string] $archiveName, [string] $targetName
)
# 外部环境变量包括:
# archiveName: ${{ matrix.qt_ver }}-${{ matrix.qt_arch }}
# winSdkDir: ${{ steps.build.outputs.winSdkDir }}
# winSdkVer: ${{ steps.build.outputs.winSdkVer }}
# vcToolsInstallDir: ${{ steps.build.outputs.vcToolsInstallDir }}
# vcToolsRedistDir: ${{ steps.build.outputs.vcToolsRedistDir }}
# msvcArch: ${{ matrix.msvc_arch }}
# winSdkDir: C:\Program Files (x86)\Windows Kits\10\
# winSdkVer: 10.0.19041.0\
# vcToolsInstallDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\MSVC\14.28.29333\
# vcToolsRedistDir: C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Redist\MSVC\14.28.29325\
# archiveName: 5.9.9-win32_msvc2015
# msvcArch: x86
$scriptDir = $PSScriptRoot
$currentDir = Get-Location
Write-Host "currentDir" $currentDir
Write-Host "scriptDir" $scriptDir
function Main() {
2023-09-29 17:22:22 +08:00
New-Item -ItemType Directory dist
2023-03-07 23:41:44 +08:00
# 拷贝exe
2023-09-29 17:22:22 +08:00
Copy-Item bin\release\* dist -Force -Recurse | Out-Null
2023-03-07 23:41:44 +08:00
# 拷贝依赖
2023-09-29 17:22:22 +08:00
windeployqt --qmldir . --plugindir dist\plugins --no-translations --compiler-runtime dist\$targetName
2023-03-07 23:41:44 +08:00
# 删除不必要的文件
$excludeList = @("*.qmlc", "*.ilk", "*.exp", "*.lib", "*.pdb")
2023-09-29 17:22:22 +08:00
Remove-Item -Path dist -Include $excludeList -Recurse -Force
2023-03-07 23:41:44 +08:00
# 拷贝vcRedist dll
$redistDll="{0}{1}\*.CRT\*.dll" -f $env:vcToolsRedistDir.Trim(),$env:msvcArch
2023-09-29 17:22:22 +08:00
Copy-Item $redistDll dist\
2023-03-07 23:41:44 +08:00
# 拷贝WinSDK dll
$sdkDll="{0}Redist\{1}ucrt\DLLs\{2}\*.dll" -f $env:winSdkDir.Trim(),$env:winSdkVer.Trim(),$env:msvcArch
2023-09-29 17:22:22 +08:00
Copy-Item $sdkDll dist\
2023-03-07 23:41:44 +08:00
# 打包zip
2023-09-29 17:22:22 +08:00
Compress-Archive -Path dist $archiveName'.zip'
2023-03-07 23:41:44 +08:00
}
if ($null -eq $archiveName || $null -eq $targetName) {
Write-Host "args missing, archiveName is" $archiveName ", targetName is" $targetName
return
}
Main