update powershell file for windows
This commit is contained in:
3
.github/workflows/pake_build.yaml
vendored
3
.github/workflows/pake_build.yaml
vendored
@@ -79,8 +79,7 @@ jobs:
|
||||
if: matrix.os == 'windows-latest'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$PSVersionTable
|
||||
.\script\build.ps1
|
||||
build:all-windows
|
||||
|
||||
- name: Upload files
|
||||
env:
|
||||
|
||||
3
.github/workflows/pake_build_with_cache.yaml
vendored
3
.github/workflows/pake_build_with_cache.yaml
vendored
@@ -76,8 +76,7 @@ jobs:
|
||||
if: matrix.os == 'windows-latest'
|
||||
shell: pwsh
|
||||
run: |
|
||||
$PSVersionTable
|
||||
.\script\build.ps1
|
||||
build:all-windows
|
||||
|
||||
- name: Upload files
|
||||
env:
|
||||
|
||||
69
script/build.ps1
vendored
69
script/build.ps1
vendored
@@ -17,8 +17,13 @@ if (-not (Test-Path output\windows)) {
|
||||
|
||||
Write-Host "`n======================="
|
||||
Write-Host "build for windows"
|
||||
Write-Host "make ture powershell == 7.2.10"
|
||||
Write-Host "powershell 7.2.10 download url: https://github.com/PowerShell/PowerShell/releases/tag/v7.2.10"
|
||||
Write-Host "Powershell info in your localhost "
|
||||
$PSVersionTable
|
||||
Write-Host "=======================`n"
|
||||
|
||||
|
||||
$identifier_prefix = "com.tw93"
|
||||
|
||||
# total package number
|
||||
@@ -44,36 +49,34 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
|
||||
Write-Host "=========================="
|
||||
# -- replace url --
|
||||
# clear url with regex
|
||||
.\script\sd.exe "`"url`":\s`"(.*?)`"" '"url": ""' $common_conf_path
|
||||
(Get-Content -Path $common_conf_path -Raw) -replace '"url":\s*"[^"]*"', '"url": ""' | Set-Content -Path $common_conf_path
|
||||
# replace url with no regex
|
||||
.\script\sd.exe -s '"url": ""' "`"url`": `"${url}`"" $common_conf_path
|
||||
(Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"url": ""', "`"url`": `"${url}`"") } | Set-Content $common_conf_path
|
||||
|
||||
|
||||
# replace package name
|
||||
# clear package_name with regex
|
||||
.\script\sd.exe "`"productName`":\s`"(.*?)`"" '"productName": ""' $common_conf_path
|
||||
(Get-Content -Path $common_conf_path -Raw) -replace '"productName":\s*"[^"]*"', '"productName": ""' | Set-Content -Path $common_conf_path
|
||||
# replace package_name with no regex
|
||||
.\script\sd.exe -s '"productName": ""' "`"productName`": `"$title`"" $common_conf_path
|
||||
(Get-Content -Path $common_conf_path -Raw) | ForEach-Object { $_.Replace('"productName": ""', "`"productName`": `"${title}`"") } | Set-Content $common_conf_path
|
||||
|
||||
# -- replace icon --
|
||||
# clear icon path with regex
|
||||
# (Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"icon":\s*\[[^\]]*\]', '"icon": []' | Set-Content -Path $windows_conf_path
|
||||
.\script\sd.exe "`"icon`":\s(.*)`]" '"icon": []' $windows_conf_path
|
||||
(Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"icon":\s*\[[^\]]*\]', '"icon": []' | Set-Content -Path $windows_conf_path
|
||||
# replace icon path with no regex
|
||||
.\script\sd.exe -s '"icon": []' "`"icon`": [`"png/${name}_256.ico`", `"png/${name}_32.ico`"]" $windows_conf_path
|
||||
(Get-Content -Path $windows_conf_path -Raw) | ForEach-Object { $_.Replace('"icon": []', "`"icon`": [`"png/${name}_256.ico`", `"png/${name}_32.ico`"]") } | Set-Content $windows_conf_path
|
||||
|
||||
# -- replace identifier --
|
||||
# clear identifier with regex
|
||||
# (Get-Content -Path $windows_conf_path -Raw) -replace '"identifier":\s*"[^"]*"', '"identifier": ""' | Set-Content -Path $windows_conf_path
|
||||
.\script\sd.exe "`"identifier`":\s`"(.*?)`"" '"identifier": ""' $windows_conf_path
|
||||
(Get-Content -Path $windows_conf_path -Raw) -replace '"identifier":\s*"[^"]*"', '"identifier": ""' | Set-Content -Path $windows_conf_path
|
||||
# -- replace identifier with no regex --
|
||||
.\script\sd.exe -s '"identifier": ""' "`"identifier`": `"${identifier_prefix}.${name}`"" $windows_conf_path
|
||||
(Get-Content -Path $windows_conf_path -Raw) | ForEach-Object { $_.Replace('"identifier": ""', "`"identifier`": `"${identifier_prefix}.${name}`"") } | Set-Content $windows_conf_path
|
||||
|
||||
# -- replace icon resources --
|
||||
# clear resources with regex
|
||||
#(Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"resources":\s*\[[^\]]*\]', '"resources": []' | Set-Content -Path $windows_conf_path
|
||||
.\script\sd.exe "`"resources`":\s(.*)`]" '"resources": []' $windows_conf_path
|
||||
(Get-Content -Path $windows_conf_path -Raw) -replace '(?s)"resources":\s*\[[^\]]*\]', '"resources": []' | Set-Content -Path $windows_conf_path
|
||||
# replace resources with no regex
|
||||
.\script\sd.exe -s '"resources": []' "`"resources`": [`"png/${name}_32.ico`"]" $windows_conf_path
|
||||
(Get-Content -Path $windows_conf_path -Raw) | ForEach-Object { $_.Replace('"resources": []', "`"resources`": [`"png/${name}_32.ico`"]") } | Set-Content $windows_conf_path
|
||||
|
||||
if (-not (Test-Path "src-tauri\png\${name}_32.ico")) {
|
||||
Copy-Item "src-tauri\png\icon_32.ico" "src-tauri\png\${name}_32.ico"
|
||||
@@ -97,27 +100,27 @@ ForEach ($line in (Get-Content -Path .\app.csv | Select-Object -Skip 1)) {
|
||||
Write-Host "package build success!"
|
||||
Write-Host ""
|
||||
$index++
|
||||
# # strip blank line for common_conf_path
|
||||
# $lines = Get-Content ${common_conf_path}
|
||||
# $lastNonEmptyLineIndex = ($lines.Count - 1)
|
||||
# while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
||||
# $lastNonEmptyLineIndex--
|
||||
# }
|
||||
# if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
||||
# $lines = $lines[0..$lastNonEmptyLineIndex]
|
||||
# }
|
||||
# Set-Content -Path ${common_conf_path} -Value $lines
|
||||
# strip blank line for common_conf_path
|
||||
$lines = Get-Content ${common_conf_path}
|
||||
$lastNonEmptyLineIndex = ($lines.Count - 1)
|
||||
while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
||||
$lastNonEmptyLineIndex--
|
||||
}
|
||||
if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
||||
$lines = $lines[0..$lastNonEmptyLineIndex]
|
||||
}
|
||||
Set-Content -Path ${common_conf_path} -Value $lines
|
||||
|
||||
# # strip blank line for windows conf_path
|
||||
# $lines = Get-Content ${windows_conf_path}
|
||||
# $lastNonEmptyLineIndex = ($lines.Count - 1)
|
||||
# while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
||||
# $lastNonEmptyLineIndex--
|
||||
# }
|
||||
# if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
||||
# $lines = $lines[0..$lastNonEmptyLineIndex]
|
||||
# }
|
||||
# Set-Content -Path ${windows_conf_path} -Value $lines
|
||||
# strip blank line for windows conf_path
|
||||
$lines = Get-Content ${windows_conf_path}
|
||||
$lastNonEmptyLineIndex = ($lines.Count - 1)
|
||||
while ($lastNonEmptyLineIndex -ge 0 -and -not $lines[$lastNonEmptyLineIndex].Trim()) {
|
||||
$lastNonEmptyLineIndex--
|
||||
}
|
||||
if ($lastNonEmptyLineIndex -lt ($lines.Count - 1)) {
|
||||
$lines = $lines[0..$lastNonEmptyLineIndex]
|
||||
}
|
||||
Set-Content -Path ${windows_conf_path} -Value $lines
|
||||
}
|
||||
|
||||
Write-Host "output dir is output\windows"
|
||||
|
||||
@@ -23,6 +23,3 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user